File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6961,15 +6961,16 @@ PyLongWriter_Finish(PyLongWriter *writer)
69616961#ifdef Py_DEBUG
69626962 // gh-147988: Detect uninitialized digits: long_alloc() fills digits with
69636963 // 0xFF byte pattern. It's posssible because PyLong_BASE is smaller than
6964- // the maximum value of the C digit type (uint32_t or unsigned short).
6964+ // the maximum value of the C digit type (uint32_t or unsigned short):
6965+ // most significan bits are unused by the API.
69656966 Py_ssize_t ndigits = _PyLong_DigitCount (obj );
69666967 if (ndigits == 0 ) {
69676968 // Check ob_digit[0] digit for the number zero
69686969 ndigits = 1 ;
69696970 }
69706971 for (Py_ssize_t i = 0 ; i < ndigits ; i ++ ) {
69716972 digit d = obj -> long_value .ob_digit [i ];
6972- if (d >= PyLong_BASE ) {
6973+ if (d & ~( digit ) PyLong_MASK ) {
69736974 Py_DECREF (obj );
69746975 PyErr_Format (PyExc_SystemError ,
69756976 "PyLongWriter_Finish: digit %zd is uninitialized" ,
You can’t perform that action at this time.
0 commit comments