Skip to content

Commit 113b2d7

Browse files
authored
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).
1 parent 29951c8 commit 113b2d7

File tree

2 files changed

+142
-100
lines changed

2 files changed

+142
-100
lines changed

Diff for: Include/cpython/longobject.h

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# error "this header file must not be included directly"
33
#endif
44

5+
#define _PyLong_CAST(op) \
6+
(assert(PyLong_Check(op)), _Py_CAST(PyLongObject*, (op)))
7+
58
PyAPI_FUNC(PyObject*) PyLong_FromUnicodeObject(PyObject *u, int base);
69

710
#define Py_ASNATIVEBYTES_DEFAULTS -1

0 commit comments

Comments
 (0)