gh-120389: Add PyLong_FromInt64() and PyLong_AsInt64() (#120390)
Add new functions to convert C <stdint.h> numbers from/to Python int: * PyLong_FromInt32() * PyLong_FromUInt32() * PyLong_FromInt64() * PyLong_FromUInt64() * PyLong_AsInt32() * PyLong_AsUInt32() * PyLong_AsInt64() * PyLong_AsUInt64()
This commit is contained in:
@@ -30,6 +30,18 @@ PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *);
|
||||
PyAPI_FUNC(int) PyLong_AsInt(PyObject *);
|
||||
#endif
|
||||
|
||||
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030e0000
|
||||
PyAPI_FUNC(PyObject*) PyLong_FromInt32(int32_t value);
|
||||
PyAPI_FUNC(PyObject*) PyLong_FromUInt32(uint32_t value);
|
||||
PyAPI_FUNC(PyObject*) PyLong_FromInt64(int64_t value);
|
||||
PyAPI_FUNC(PyObject*) PyLong_FromUInt64(uint64_t value);
|
||||
|
||||
PyAPI_FUNC(int) PyLong_AsInt32(PyObject *obj, int32_t *value);
|
||||
PyAPI_FUNC(int) PyLong_AsUInt32(PyObject *obj, uint32_t *value);
|
||||
PyAPI_FUNC(int) PyLong_AsInt64(PyObject *obj, int64_t *value);
|
||||
PyAPI_FUNC(int) PyLong_AsUInt64(PyObject *obj, uint64_t *value);
|
||||
#endif
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyLong_GetInfo(void);
|
||||
|
||||
/* It may be useful in the future. I've added it in the PyInt -> PyLong
|
||||
|
||||
Reference in New Issue
Block a user