Skip to content

Commit

Permalink
Try backporting Py_SET_SIZE to Python 3.8.
Browse files Browse the repository at this point in the history
  • Loading branch information
culler committed Nov 6, 2023
1 parent ba49729 commit 536cf95
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cypari/pylong_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@
* See longintrepr.h for more details.
*/

#if PY_MINOR_VERSION < 9

static inline void _Py_SET_SIZE(PyVarObject *ob, Py_ssize_t size) {
ob->ob_size = size;
}
#define Py_SET_SIZE(ob, size) _Py_SET_SIZE(_PyVarObject_CAST(ob), size)

#endif

typedef struct _longobject* py_long;

inline Py_ssize_t CyPari_Sign(PyObject *op) {
Expand Down

0 comments on commit 536cf95

Please sign in to comment.