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
c337838a
Kaydet (Commit)
c337838a
authored
Mar 28, 2015
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #22117: Use the new _PyTime_t API in the select module
üst
f5faad2b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
41 deletions
+22
-41
pytime.h
Include/pytime.h
+1
-1
selectmodule.c
Modules/selectmodule.c
+20
-39
pytime.c
Python/pytime.c
+1
-1
No files found.
Include/pytime.h
Dosyayı görüntüle @
c337838a
...
...
@@ -124,7 +124,7 @@ PyAPI_FUNC(int) _PyTime_AsTimeval(_PyTime_t t,
struct
timeval
*
tv
,
_PyTime_round_t
round
);
#if
def HAVE_CLOCK_GETTIME
#if
defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE)
/* Convert a timestamp to a timespec structure (nanosecond resolution).
tv_nsec is always positive.
Raise an exception and return -1 on error, return 0 on success. */
...
...
Modules/selectmodule.c
Dosyayı görüntüle @
c337838a
...
...
@@ -206,38 +206,17 @@ select_select(PyObject *self, PyObject *args)
if
(
tout
==
Py_None
)
tvp
=
(
struct
timeval
*
)
0
;
else
if
(
!
PyNumber_Check
(
tout
))
{
PyErr_SetString
(
PyExc_TypeError
,
"timeout must be a float or None"
);
return
NULL
;
}
else
{
/* On OpenBSD 5.4, timeval.tv_sec is a long.
* Example: long is 64-bit, whereas time_t is 32-bit. */
time_t
sec
;
/* On OS X 64-bit, timeval.tv_usec is an int (and thus still 4
bytes as required), but no longer defined by a long. */
long
usec
;
if
(
_PyTime_ObjectToTimeval
(
tout
,
&
sec
,
&
usec
,
_PyTime_ROUND_UP
)
==
-
1
)
return
NULL
;
#ifdef MS_WINDOWS
/* On Windows, timeval.tv_sec is a long (32 bit),
* whereas time_t can be 64-bit. */
assert
(
sizeof
(
tv
.
tv_sec
)
==
sizeof
(
long
));
#if SIZEOF_TIME_T > SIZEOF_LONG
if
(
sec
>
LONG_MAX
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"timeout is too large"
);
_PyTime_t
ts
;
if
(
_PyTime_FromSecondsObject
(
&
ts
,
tout
,
_PyTime_ROUND_UP
)
<
0
)
{
PyErr_SetString
(
PyExc_TypeError
,
"timeout must be a float or None"
);
return
NULL
;
}
#endif
tv
.
tv_sec
=
(
long
)
sec
;
#else
assert
(
sizeof
(
tv
.
tv_sec
)
>=
sizeof
(
sec
));
tv
.
tv_sec
=
sec
;
#endif
tv
.
tv_usec
=
usec
;
if
(
_PyTime_AsTimeval
(
ts
,
&
tv
,
_PyTime_ROUND_UP
)
==
-
1
)
return
NULL
;
if
(
tv
.
tv_sec
<
0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"timeout must be non-negative"
);
return
NULL
;
...
...
@@ -2032,9 +2011,18 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
if
(
otimeout
==
Py_None
||
otimeout
==
NULL
)
{
ptimeoutspec
=
NULL
;
}
else
if
(
PyNumber_Check
(
otimeout
))
{
if
(
_PyTime_ObjectToTimespec
(
otimeout
,
&
timeout
.
tv_sec
,
&
timeout
.
tv_nsec
,
_PyTime_ROUND_UP
)
==
-
1
)
else
{
_PyTime_t
ts
;
if
(
_PyTime_FromSecondsObject
(
&
ts
,
otimeout
,
_PyTime_ROUND_UP
)
<
0
)
{
PyErr_Format
(
PyExc_TypeError
,
"timeout argument must be an number "
"or None, got %.200s"
,
Py_TYPE
(
otimeout
)
->
tp_name
);
return
NULL
;
}
if
(
_PyTime_AsTimespec
(
ts
,
&
timeout
)
==
-
1
)
return
NULL
;
if
(
timeout
.
tv_sec
<
0
)
{
...
...
@@ -2044,13 +2032,6 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
}
ptimeoutspec
=
&
timeout
;
}
else
{
PyErr_Format
(
PyExc_TypeError
,
"timeout argument must be an number "
"or None, got %.200s"
,
Py_TYPE
(
otimeout
)
->
tp_name
);
return
NULL
;
}
if
(
ch
!=
NULL
&&
ch
!=
Py_None
)
{
it
=
PyObject_GetIter
(
ch
);
...
...
Python/pytime.c
Dosyayı görüntüle @
c337838a
...
...
@@ -469,7 +469,7 @@ _PyTime_AsTimeval(_PyTime_t t, struct timeval *tv, _PyTime_round_t round)
return
res
;
}
#if
def HAVE_CLOCK_GETTIME
#if
defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE)
int
_PyTime_AsTimespec
(
_PyTime_t
t
,
struct
timespec
*
ts
)
{
...
...
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