summaryrefslogtreecommitdiffstats
path: root/Include/cpython
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-10-02 15:41:19 (GMT)
committerGitHub <noreply@github.com>2024-10-02 15:41:19 (GMT)
commit113b2d7583cdbf79da18e696f299a9aca24b599b (patch)
treeca4dbc894695882f5aaab3302c1d4d59c24a2c1a /Include/cpython
parent29951c8471f4b4283493c8e3f768d967d0bdd564 (diff)
downloadcpython-113b2d7583cdbf79da18e696f299a9aca24b599b.zip
cpython-113b2d7583cdbf79da18e696f299a9aca24b599b.tar.gz
cpython-113b2d7583cdbf79da18e696f299a9aca24b599b.tar.bz2
gh-111178: Fix function signatures in longobject.c (#124895)
* Add _PyLong_CAST() macro. * Move forward declarations to the top of longobject.c. * Change long_add(), long_sub(), long_mul(), long_neg(), long_lshift(), long_abs() to take PyLongObject* and return PyLongObject*. Avoid CHECK_BINOP() test. * Add long_add_method(), long_sub_method(), long_mul_method(), long_neg_method(), long_lshift_method(), and long_abs_method() which take PyObject* and return PyObject*. Implement CHECK_BINOP() test. * Add long_lshift_int64() function. * _PyLong_DivmodNear() calls long_lshift_int64(obj, 1) instead of long_lshift_obj(obj, one).
Diffstat (limited to 'Include/cpython')
-rw-r--r--Include/cpython/longobject.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Include/cpython/longobject.h b/Include/cpython/longobject.h
index b239f7c..c1214d5 100644
--- a/Include/cpython/longobject.h
+++ b/Include/cpython/longobject.h
@@ -2,6 +2,9 @@
# error "this header file must not be included directly"
#endif
+#define _PyLong_CAST(op) \
+ (assert(PyLong_Check(op)), _Py_CAST(PyLongObject*, (op)))
+
PyAPI_FUNC(PyObject*) PyLong_FromUnicodeObject(PyObject *u, int base);
#define Py_ASNATIVEBYTES_DEFAULTS -1