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
41cfce9c
Kaydet (Commit)
41cfce9c
authored
Agu 24, 2007
tarafından
Skip Montanaro
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove PyArg_Parse usage from time module. (An extra set of eyeballs on
this would be nice. I'm a little rusty.)
üst
b382b84a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
10 deletions
+55
-10
structseq.h
Include/structseq.h
+4
-0
timemodule.c
Modules/timemodule.c
+51
-10
No files found.
Include/structseq.h
Dosyayı görüntüle @
41cfce9c
...
...
@@ -35,6 +35,10 @@ typedef struct {
#define PyStructSequence_SET_ITEM(op, i, v) \
(((PyStructSequence *)(op))->ob_item[i] = v)
#define PyStructSequence_GET_ITEM(op, i) \
(((PyStructSequence *)(op))->ob_item[i])
#ifdef __cplusplus
}
#endif
...
...
Modules/timemodule.c
Dosyayı görüntüle @
41cfce9c
...
...
@@ -254,6 +254,29 @@ tmtotuple(struct tm *p)
return
v
;
}
static
PyObject
*
structtime_totuple
(
PyObject
*
t
)
{
PyObject
*
x
=
NULL
;
unsigned
int
i
;
PyObject
*
v
=
PyTuple_New
(
9
);
if
(
v
==
NULL
)
return
NULL
;
for
(
i
=
0
;
i
<
9
;
i
++
)
{
x
=
PyStructSequence_GET_ITEM
(
t
,
i
);
Py_INCREF
(
x
);
PyTuple_SET_ITEM
(
v
,
i
,
x
);
}
if
(
PyErr_Occurred
())
{
Py_XDECREF
(
v
);
return
NULL
;
}
return
v
;
}
static
PyObject
*
time_convert
(
double
when
,
struct
tm
*
(
*
function
)(
const
time_t
*
))
{
...
...
@@ -332,18 +355,36 @@ gettmarg(PyObject *args, struct tm *p)
{
int
y
;
memset
((
void
*
)
p
,
'\0'
,
sizeof
(
struct
tm
));
PyObject
*
t
=
NULL
;
if
(
!
PyArg_Parse
(
args
,
"(iiiiiiiii)"
,
&
y
,
&
p
->
tm_mon
,
&
p
->
tm_mday
,
&
p
->
tm_hour
,
&
p
->
tm_min
,
&
p
->
tm_sec
,
&
p
->
tm_wday
,
&
p
->
tm_yday
,
&
p
->
tm_isdst
))
if
(
PyTuple_Check
(
args
))
{
t
=
args
;
Py_INCREF
(
t
);
}
else
if
(
Py_Type
(
args
)
==
&
StructTimeType
)
{
t
=
structtime_totuple
(
args
);
}
else
{
PyErr_SetString
(
PyExc_TypeError
,
"Tuple or struct_time argument required"
);
return
0
;
}
if
(
t
==
NULL
||
!
PyArg_ParseTuple
(
t
,
"iiiiiiiii"
,
&
y
,
&
p
->
tm_mon
,
&
p
->
tm_mday
,
&
p
->
tm_hour
,
&
p
->
tm_min
,
&
p
->
tm_sec
,
&
p
->
tm_wday
,
&
p
->
tm_yday
,
&
p
->
tm_isdst
))
{
Py_XDECREF
(
t
);
return
0
;
}
Py_DECREF
(
t
);
if
(
y
<
1900
)
{
PyObject
*
accept
=
PyDict_GetItemString
(
moddict
,
"accept2dyear"
);
...
...
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