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
e3d1d411
Kaydet (Commit)
e3d1d411
authored
May 23, 2007
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix datetime and its test.
üst
1be7e3f2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
9 deletions
+23
-9
test_datetime.py
Lib/test/test_datetime.py
+2
-1
datetimemodule.c
Modules/datetimemodule.c
+21
-8
No files found.
Lib/test/test_datetime.py
Dosyayı görüntüle @
e3d1d411
...
...
@@ -1098,7 +1098,8 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase):
# This shouldn't blow up because of the month byte alone. If
# the implementation changes to do more-careful checking, it may
# blow up because other fields are insane.
self
.
theclass
(
base
[:
2
]
+
chr
(
ord_byte
)
+
base
[
3
:])
# XXX Maybe this will have to become bytes?
self
.
theclass
(
str8
(
base
[:
2
]
+
chr
(
ord_byte
)
+
base
[
3
:]))
#############################################################################
# datetime tests
...
...
Modules/datetimemodule.c
Dosyayı görüntüle @
e3d1d411
...
...
@@ -927,7 +927,8 @@ call_dst(PyObject *tzinfo, PyObject *tzinfoarg, int *none)
/* Call tzinfo.tzname(tzinfoarg), and return the result. tzinfo must be
* an instance of the tzinfo class or None. If tzinfo isn't None, and
* tzname() doesn't return None or a string, TypeError is raised and this
* returns NULL.
* returns NULL. If the result is a string, we ensure it is a Unicode
* string.
*/
static
PyObject
*
call_tzname
(
PyObject
*
tzinfo
,
PyObject
*
tzinfoarg
)
...
...
@@ -945,12 +946,19 @@ call_tzname(PyObject *tzinfo, PyObject *tzinfoarg)
else
result
=
PyObject_CallMethod
(
tzinfo
,
"tzname"
,
"O"
,
tzinfoarg
);
if
(
result
!=
NULL
&&
result
!=
Py_None
&&
!
PyString_Check
(
result
))
{
PyErr_Format
(
PyExc_TypeError
,
"tzinfo.tzname() must "
"return None or a string, not '%s'"
,
result
->
ob_type
->
tp_name
);
Py_DECREF
(
result
);
result
=
NULL
;
if
(
result
!=
NULL
&&
result
!=
Py_None
)
{
if
(
!
PyString_Check
(
result
)
&&
!
PyUnicode_Check
(
result
))
{
PyErr_Format
(
PyExc_TypeError
,
"tzinfo.tzname() must "
"return None or a string, not '%s'"
,
result
->
ob_type
->
tp_name
);
Py_DECREF
(
result
);
result
=
NULL
;
}
else
if
(
!
PyUnicode_Check
(
result
))
{
PyObject
*
temp
=
PyUnicode_FromObject
(
result
);
Py_DECREF
(
result
);
result
=
temp
;
}
}
return
result
;
}
...
...
@@ -1241,7 +1249,7 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
temp
=
call_tzname
(
tzinfo
,
tzinfoarg
);
if
(
temp
==
NULL
)
goto
Done
;
if
(
temp
!=
Py_None
)
{
assert
(
Py
String
_Check
(
temp
));
assert
(
Py
Unicode
_Check
(
temp
));
/* Since the tzname is getting
* stuffed into the format, we
* have to double any % signs
...
...
@@ -1255,6 +1263,11 @@ wrap_strftime(PyObject *object, PyObject *format, PyObject *timetuple,
Py_DECREF
(
temp
);
if
(
Zreplacement
==
NULL
)
goto
Done
;
if
(
PyUnicode_Check
(
Zreplacement
))
{
Zreplacement
=
_PyUnicode_AsDefaultEncodedString
(
Zreplacement
,
NULL
);
if
(
Zreplacement
==
NULL
)
goto
Done
;
}
if
(
!
PyString_Check
(
Zreplacement
))
{
PyErr_SetString
(
PyExc_TypeError
,
"tzname.replace() did not return a string"
);
goto
Done
;
...
...
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