Skip to content

Commit

Permalink
backport cherry pick fix: lookup max from the right place.
Browse files Browse the repository at this point in the history
  • Loading branch information
gpshead committed Sep 4, 2022
1 parent 39837b6 commit 7f911c1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1614,8 +1614,7 @@ long_to_decimal_string_internal(PyObject *aa,
*/
if (size_a >= 10 * _PY_LONG_MAX_STR_DIGITS_THRESHOLD
/ (3 * PyLong_SHIFT) + 2) {
PyInterpreterState *interp = _PyInterpreterState_GET();
int max_str_digits = interp->int_max_str_digits;
int max_str_digits = _PyRuntime.int_max_str_digits;
if ((max_str_digits > 0) &&
(max_str_digits / (3 * PyLong_SHIFT) <= (size_a - 11) / 10)) {
PyErr_Format(PyExc_ValueError, _MAX_STR_DIGITS_ERROR_FMT_TO_STR,
Expand Down

0 comments on commit 7f911c1

Please sign in to comment.