diff options
author | Mark Shannon <mark@hotpy.org> | 2023-03-22 14:49:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-22 14:49:51 (GMT) |
commit | 7559f5fda94ab568a1a910b17683ed81dc3426fb (patch) | |
tree | a050bbc075372c6246fe3386560596f2283ae8bb /Objects/abstract.c | |
parent | 713df2c53489ce8012d0ede10b70950e6b0d8372 (diff) | |
download | cpython-7559f5fda94ab568a1a910b17683ed81dc3426fb.zip cpython-7559f5fda94ab568a1a910b17683ed81dc3426fb.tar.gz cpython-7559f5fda94ab568a1a910b17683ed81dc3426fb.tar.bz2 |
GH-101291: Rearrange the size bits in PyLongObject (GH-102464)
* Eliminate all remaining uses of Py_SIZE and Py_SET_SIZE on PyLongObject, adding asserts.
* Change layout of size/sign bits in longobject to support future addition of immortal ints and tagged medium ints.
* Add functions to hide some internals of long object, and for setting sign and digit count.
* Replace uses of IS_MEDIUM_VALUE macro with _PyLong_IsCompact().
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r-- | Objects/abstract.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 9dc74fb..e957859 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -5,6 +5,7 @@ #include "pycore_call.h" // _PyObject_CallNoArgs() #include "pycore_ceval.h" // _Py_EnterRecursiveCallTstate() #include "pycore_object.h" // _Py_CheckSlotResult() +#include "pycore_long.h" // _Py_IsNegative #include "pycore_pyerrors.h" // _PyErr_Occurred() #include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_unionobject.h" // _PyUnion_Check() @@ -1483,7 +1484,7 @@ PyNumber_AsSsize_t(PyObject *item, PyObject *err) /* Whether or not it is less than or equal to zero is determined by the sign of ob_size */ - if (_PyLong_Sign(value) < 0) + if (_PyLong_IsNegative((PyLongObject *)value)) result = PY_SSIZE_T_MIN; else result = PY_SSIZE_T_MAX; |