Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
6bd238cb
Kaydet (Commit)
6bd238cb
authored
Kas 22, 2007
tarafından
Walter Dörwald
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use PyString instead of PyBytes in wrap_strftime().
üst
f386311f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
datetimemodule.c
Modules/datetimemodule.c
+10
-10
No files found.
Modules/datetimemodule.c
Dosyayı görüntüle @
6bd238cb
...
@@ -1237,9 +1237,9 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
...
@@ -1237,9 +1237,9 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
* is expensive, don't unless they're actually used.
* is expensive, don't unless they're actually used.
*/
*/
totalnew
=
flen
+
1
;
/* realistic if no %z/%Z */
totalnew
=
flen
+
1
;
/* realistic if no %z/%Z */
newfmt
=
Py
Bytes
_FromStringAndSize
(
NULL
,
totalnew
);
newfmt
=
Py
String
_FromStringAndSize
(
NULL
,
totalnew
);
if
(
newfmt
==
NULL
)
goto
Done
;
if
(
newfmt
==
NULL
)
goto
Done
;
pnew
=
Py
Bytes
_AsString
(
newfmt
);
pnew
=
Py
String
_AsString
(
newfmt
);
usednew
=
0
;
usednew
=
0
;
while
((
ch
=
*
pin
++
)
!=
'\0'
)
{
while
((
ch
=
*
pin
++
)
!=
'\0'
)
{
...
@@ -1259,7 +1259,7 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
...
@@ -1259,7 +1259,7 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
/* format utcoffset */
/* format utcoffset */
char
buf
[
100
];
char
buf
[
100
];
PyObject
*
tzinfo
=
get_tzinfo_member
(
object
);
PyObject
*
tzinfo
=
get_tzinfo_member
(
object
);
zreplacement
=
Py
Bytes
_FromStringAndSize
(
""
,
0
);
zreplacement
=
Py
String
_FromStringAndSize
(
""
,
0
);
if
(
zreplacement
==
NULL
)
goto
Done
;
if
(
zreplacement
==
NULL
)
goto
Done
;
if
(
tzinfo
!=
Py_None
&&
tzinfo
!=
NULL
)
{
if
(
tzinfo
!=
Py_None
&&
tzinfo
!=
NULL
)
{
assert
(
tzinfoarg
!=
NULL
);
assert
(
tzinfoarg
!=
NULL
);
...
@@ -1271,15 +1271,15 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
...
@@ -1271,15 +1271,15 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
goto
Done
;
goto
Done
;
Py_DECREF
(
zreplacement
);
Py_DECREF
(
zreplacement
);
zreplacement
=
zreplacement
=
Py
Bytes
_FromStringAndSize
(
buf
,
Py
String
_FromStringAndSize
(
buf
,
strlen
(
buf
));
strlen
(
buf
));
if
(
zreplacement
==
NULL
)
if
(
zreplacement
==
NULL
)
goto
Done
;
goto
Done
;
}
}
}
}
assert
(
zreplacement
!=
NULL
);
assert
(
zreplacement
!=
NULL
);
ptoappend
=
Py
Bytes
_AS_STRING
(
zreplacement
);
ptoappend
=
Py
String
_AS_STRING
(
zreplacement
);
ntoappend
=
Py
Bytes
_GET_SIZE
(
zreplacement
);
ntoappend
=
Py
String
_GET_SIZE
(
zreplacement
);
}
}
else
if
(
ch
==
'Z'
)
{
else
if
(
ch
==
'Z'
)
{
/* format tzname */
/* format tzname */
...
@@ -1314,10 +1314,10 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
...
@@ -1314,10 +1314,10 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
PyErr_NoMemory
();
PyErr_NoMemory
();
goto
Done
;
goto
Done
;
}
}
if
(
PyBytes_Resize
(
newfmt
,
bigger
)
<
0
)
if
(
_PyString_Resize
(
&
newfmt
,
bigger
)
<
0
)
goto
Done
;
goto
Done
;
totalnew
=
bigger
;
totalnew
=
bigger
;
pnew
=
Py
Bytes
_AsString
(
newfmt
)
+
usednew
;
pnew
=
Py
String
_AsString
(
newfmt
)
+
usednew
;
}
}
memcpy
(
pnew
,
ptoappend
,
ntoappend
);
memcpy
(
pnew
,
ptoappend
,
ntoappend
);
pnew
+=
ntoappend
;
pnew
+=
ntoappend
;
...
@@ -1325,14 +1325,14 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
...
@@ -1325,14 +1325,14 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
assert
(
usednew
<=
totalnew
);
assert
(
usednew
<=
totalnew
);
}
/* end while() */
}
/* end while() */
if
(
PyBytes_Resize
(
newfmt
,
usednew
)
<
0
)
if
(
_PyString_Resize
(
&
newfmt
,
usednew
)
<
0
)
goto
Done
;
goto
Done
;
{
{
PyObject
*
format
;
PyObject
*
format
;
PyObject
*
time
=
PyImport_ImportModule
(
"time"
);
PyObject
*
time
=
PyImport_ImportModule
(
"time"
);
if
(
time
==
NULL
)
if
(
time
==
NULL
)
goto
Done
;
goto
Done
;
format
=
PyUnicode_FromString
(
Py
Bytes
_AS_STRING
(
newfmt
));
format
=
PyUnicode_FromString
(
Py
String
_AS_STRING
(
newfmt
));
if
(
format
!=
NULL
)
{
if
(
format
!=
NULL
)
{
result
=
PyObject_CallMethod
(
time
,
"strftime"
,
"OO"
,
result
=
PyObject_CallMethod
(
time
,
"strftime"
,
"OO"
,
format
,
timetuple
);
format
,
timetuple
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment