summaryrefslogtreecommitdiffstats
path: root/Modules/_io
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-06-24 06:49:01 (GMT)
committerGitHub <noreply@github.com>2024-06-24 06:49:01 (GMT)
commit02df6795743ee4ee26a07986edbb5e22ae9fec8b (patch)
treedf7c0e397621b2126f1691250a194d461d8b36ab /Modules/_io
parent35e998f5608b04cdd331e67dd80d4829df71a5fd (diff)
downloadcpython-02df6795743ee4ee26a07986edbb5e22ae9fec8b.zip
cpython-02df6795743ee4ee26a07986edbb5e22ae9fec8b.tar.gz
cpython-02df6795743ee4ee26a07986edbb5e22ae9fec8b.tar.bz2
Use _PyLong_IsNegative instead of _PyLong_Sign if appropriate. (GH-120493)
It is faster and more obvious.
Diffstat (limited to 'Modules/_io')
-rw-r--r--Modules/_io/_iomodule.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c
index 269070f..d236098 100644
--- a/Modules/_io/_iomodule.c
+++ b/Modules/_io/_iomodule.c
@@ -10,7 +10,7 @@
#include "Python.h"
#include "pycore_abstract.h" // _PyNumber_Index()
#include "pycore_initconfig.h" // _PyStatus_OK()
-#include "pycore_long.h" // _PyLong_Sign()
+#include "pycore_long.h" // _PyLong_IsNegative()
#include "pycore_pyerrors.h" // _PyErr_ChainExceptions1()
#include "pycore_pystate.h" // _PyInterpreterState_GET()
@@ -544,10 +544,7 @@ PyNumber_AsOff_t(PyObject *item, PyObject *err)
*/
if (!err) {
assert(PyLong_Check(value));
- /* 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_OFF_T_MIN;
else
result = PY_OFF_T_MAX;