diff --git a/src/gmpy2_convert.h b/src/gmpy2_convert.h index 061e82cd..51bdb397 100644 --- a/src/gmpy2_convert.h +++ b/src/gmpy2_convert.h @@ -154,44 +154,6 @@ extern "C" { # define _PyLong_DigitCount(obj) (_PyLong_IsNegative(obj)? -Py_SIZE(obj):Py_SIZE(obj)) #endif -#if PY_VERSION_HEX >= 0x030D0000 - -#define MAX_LONG_DIGITS \ - ((PY_SSIZE_T_MAX - offsetof(PyLongObject, long_value.ob_digit))/sizeof(digit)) - -PyLongObject * -_PyLong_New(Py_ssize_t size) -{ - assert(size >= 0); - PyLongObject *result; - if (size > (Py_ssize_t)MAX_LONG_DIGITS) { - PyErr_SetString(PyExc_OverflowError, - "too many digits in integer"); - return NULL; - } - /* Fast operations for single digit integers (including zero) - * assume that there is always at least one digit present. */ - Py_ssize_t ndigits = size ? size : 1; - /* Number of bytes needed is: offsetof(PyLongObject, ob_digit) + - sizeof(digit)*size. Previous incarnations of this code used - sizeof() instead of the offsetof, but this risks being - incorrect in the presence of padding between the header - and the digits. */ - result = PyObject_Malloc(offsetof(PyLongObject, long_value.ob_digit) + - ndigits*sizeof(digit)); - if (!result) { - PyErr_NoMemory(); - return NULL; - } - _PyLong_SetSignAndDigitCount(result, size != 0, size); - PyObject_Init((PyObject*)result, &PyLong_Type); - /* The digit has to be initialized explicitly to avoid - * use-of-uninitialized-value. */ - result->long_value.ob_digit[0] = 0; - return result; -} -#endif - /* Since the macros are used in gmpy2's codebase, these functions are skipped * until they are needed for the C API in the future. */ diff --git a/src/gmpy2_hash.c b/src/gmpy2_hash.c index 5ed6af23..054ff89f 100644 --- a/src/gmpy2_hash.c +++ b/src/gmpy2_hash.c @@ -24,11 +24,6 @@ * License along with GMPY2; if not, see * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#if PY_VERSION_HEX >= 0x030D0000 -# define Py_BUILD_CORE -# include -#endif - static Py_hash_t GMPy_MPZ_Hash_Slot(MPZ_Object *self) {