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
6ef9fd7c
Kaydet (Commit)
6ef9fd7c
authored
Eyl 22, 2009
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix whitespace.
üst
f778bec8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
42 deletions
+43
-42
timemodule.c
Modules/timemodule.c
+43
-42
No files found.
Modules/timemodule.c
Dosyayı görüntüle @
6ef9fd7c
...
...
@@ -404,9 +404,9 @@ time_strftime(PyObject *self, PyObject *args)
}
else
if
(
!
gettmarg
(
tup
,
&
buf
))
return
NULL
;
/* Checks added to make sure strftime() does not crash Python by
indexing blindly into some array for a textual representation
by some bad index (fixes bug #897625).
/* Checks added to make sure strftime() does not crash Python by
indexing blindly into some array for a textual representation
by some bad index (fixes bug #897625).
Also support values of zero from Python code for arguments in which
that is out of range by forcing that value to the lowest value that
...
...
@@ -427,50 +427,50 @@ time_strftime(PyObject *self, PyObject *args)
(1) gettmarg() handles bounds-checking.
(2) Python's acceptable range is one greater than the range in C,
thus need to check against automatic decrement by gettmarg().
*/
*/
if
(
buf
.
tm_mon
==
-
1
)
buf
.
tm_mon
=
0
;
else
if
(
buf
.
tm_mon
<
0
||
buf
.
tm_mon
>
11
)
{
PyErr_SetString
(
PyExc_ValueError
,
"month out of range"
);
return
NULL
;
}
PyErr_SetString
(
PyExc_ValueError
,
"month out of range"
);
return
NULL
;
}
if
(
buf
.
tm_mday
==
0
)
buf
.
tm_mday
=
1
;
else
if
(
buf
.
tm_mday
<
0
||
buf
.
tm_mday
>
31
)
{
PyErr_SetString
(
PyExc_ValueError
,
"day of month out of range"
);
return
NULL
;
}
if
(
buf
.
tm_hour
<
0
||
buf
.
tm_hour
>
23
)
{
PyErr_SetString
(
PyExc_ValueError
,
"hour out of range"
);
return
NULL
;
}
if
(
buf
.
tm_min
<
0
||
buf
.
tm_min
>
59
)
{
PyErr_SetString
(
PyExc_ValueError
,
"minute out of range"
);
return
NULL
;
}
if
(
buf
.
tm_sec
<
0
||
buf
.
tm_sec
>
61
)
{
PyErr_SetString
(
PyExc_ValueError
,
"seconds out of range"
);
return
NULL
;
}
/* tm_wday does not need checking of its upper-bound since taking
``% 7`` in gettmarg() automatically restricts the range. */
if
(
buf
.
tm_wday
<
0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"day of week out of range"
);
return
NULL
;
}
PyErr_SetString
(
PyExc_ValueError
,
"day of month out of range"
);
return
NULL
;
}
if
(
buf
.
tm_hour
<
0
||
buf
.
tm_hour
>
23
)
{
PyErr_SetString
(
PyExc_ValueError
,
"hour out of range"
);
return
NULL
;
}
if
(
buf
.
tm_min
<
0
||
buf
.
tm_min
>
59
)
{
PyErr_SetString
(
PyExc_ValueError
,
"minute out of range"
);
return
NULL
;
}
if
(
buf
.
tm_sec
<
0
||
buf
.
tm_sec
>
61
)
{
PyErr_SetString
(
PyExc_ValueError
,
"seconds out of range"
);
return
NULL
;
}
/* tm_wday does not need checking of its upper-bound since taking
``% 7`` in gettmarg() automatically restricts the range. */
if
(
buf
.
tm_wday
<
0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"day of week out of range"
);
return
NULL
;
}
if
(
buf
.
tm_yday
==
-
1
)
buf
.
tm_yday
=
0
;
else
if
(
buf
.
tm_yday
<
0
||
buf
.
tm_yday
>
365
)
{
PyErr_SetString
(
PyExc_ValueError
,
"day of year out of range"
);
return
NULL
;
}
PyErr_SetString
(
PyExc_ValueError
,
"day of year out of range"
);
return
NULL
;
}
/* Normalize tm_isdst just in case someone foolishly implements %Z
based on the assumption that tm_isdst falls within the range of
[-1, 1] */
if
(
buf
.
tm_isdst
<
-
1
)
buf
.
tm_isdst
=
-
1
;
if
(
buf
.
tm_isdst
<
-
1
)
buf
.
tm_isdst
=
-
1
;
else
if
(
buf
.
tm_isdst
>
1
)
buf
.
tm_isdst
=
1
;
buf
.
tm_isdst
=
1
;
#ifdef MS_WINDOWS
/* check that the format string contains only valid directives */
...
...
@@ -534,14 +534,15 @@ is not present, current time as returned by localtime() is used.");
static
PyObject
*
time_strptime
(
PyObject
*
self
,
PyObject
*
args
)
{
PyObject
*
strptime_module
=
PyImport_ImportModuleNoBlock
(
"_strptime"
);
PyObject
*
strptime_result
;
if
(
!
strptime_module
)
return
NULL
;
strptime_result
=
PyObject_CallMethod
(
strptime_module
,
"_strptime_time"
,
"O"
,
args
);
Py_DECREF
(
strptime_module
);
return
strptime_result
;
PyObject
*
strptime_module
=
PyImport_ImportModuleNoBlock
(
"_strptime"
);
PyObject
*
strptime_result
;
if
(
!
strptime_module
)
return
NULL
;
strptime_result
=
PyObject_CallMethod
(
strptime_module
,
"_strptime_time"
,
"O"
,
args
);
Py_DECREF
(
strptime_module
);
return
strptime_result
;
}
PyDoc_STRVAR
(
strptime_doc
,
...
...
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