@@ -2588,20 +2588,20 @@ static int
25882588fill_time (PyObject * module , PyObject * v , int s_index , int f_index , int ns_index , time_t sec , unsigned long nsec )
25892589{
25902590 assert (!PyErr_Occurred ());
2591- #define S_TO_NS (1000000000LL)
2592- assert (nsec < S_TO_NS );
2591+ #define SEC_TO_NS (1000000000LL)
2592+ assert (nsec < SEC_TO_NS );
25932593
25942594 if (s_index >= 0 ) {
25952595 PyObject * s = _PyLong_FromTime_t (sec );
2596- if (! s ) {
2596+ if (s == NULL ) {
25972597 return -1 ;
25982598 }
25992599 PyStructSequence_SET_ITEM (v , s_index , s );
26002600 }
26012601
26022602 if (f_index >= 0 ) {
2603- PyObject * float_s = PyFloat_FromDouble (sec + 1e-9 * nsec );
2604- if (! float_s ) {
2603+ PyObject * float_s = PyFloat_FromDouble (( double ) sec + 1e-9 * nsec );
2604+ if (float_s == NULL ) {
26052605 return -1 ;
26062606 }
26072607 PyStructSequence_SET_ITEM (v , f_index , float_s );
@@ -2610,9 +2610,9 @@ fill_time(PyObject *module, PyObject *v, int s_index, int f_index, int ns_index,
26102610 int res = -1 ;
26112611 if (ns_index >= 0 ) {
26122612 /* 1677-09-21 00:12:44 to 2262-04-11 23:47:15 UTC inclusive */
2613- if ((LLONG_MIN / S_TO_NS ) <= sec && sec <= (LLONG_MAX / S_TO_NS - 1 )) {
2614- PyObject * ns_total = PyLong_FromLongLong (sec * S_TO_NS + nsec );
2615- if (! ns_total ) {
2613+ if ((LLONG_MIN / SEC_TO_NS ) <= sec && sec <= (LLONG_MAX / SEC_TO_NS - 1 )) {
2614+ PyObject * ns_total = PyLong_FromLongLong (sec * SEC_TO_NS + nsec );
2615+ if (ns_total == NULL ) {
26162616 return -1 ;
26172617 }
26182618 PyStructSequence_SET_ITEM (v , ns_index , ns_total );
@@ -2624,17 +2624,17 @@ fill_time(PyObject *module, PyObject *v, int s_index, int f_index, int ns_index,
26242624 PyObject * ns_total = NULL ;
26252625 PyObject * s = _PyLong_FromTime_t (sec );
26262626 PyObject * ns_fractional = PyLong_FromUnsignedLong (nsec );
2627- if (!( s && ns_fractional ) ) {
2627+ if (s == NULL || ns_fractional == NULL ) {
26282628 goto exit ;
26292629 }
26302630
26312631 s_in_ns = PyNumber_Multiply (s , get_posix_state (module )-> billion );
2632- if (! s_in_ns ) {
2632+ if (s_in_ns == NULL ) {
26332633 goto exit ;
26342634 }
26352635
26362636 ns_total = PyNumber_Add (s_in_ns , ns_fractional );
2637- if (! ns_total ) {
2637+ if (ns_total == NULL ) {
26382638 goto exit ;
26392639 }
26402640 PyStructSequence_SET_ITEM (v , ns_index , ns_total );
@@ -2649,7 +2649,7 @@ fill_time(PyObject *module, PyObject *v, int s_index, int f_index, int ns_index,
26492649 }
26502650
26512651 return res ;
2652- #undef S_TO_NS
2652+ #undef SEC_TO_NS
26532653}
26542654
26552655#ifdef MS_WINDOWS
0 commit comments