diff options
author | Christian Tismer <tismer@stackless.com> | 2021-09-30 18:51:43 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2021-10-01 13:23:10 +0200 |
commit | 0aa413c4a3c303c0fc4a26f0fa2669969987dfc1 (patch) | |
tree | 909b12f80f12e45e525f5128adf6b734e3e37abb | |
parent | 6219fc1dad787fb24a5af72ff5c7b3fb062cb47b (diff) |
pep386impl: fix a left-over from the Python 2 cleanup
_PepLong_AsInt still existed. This may be again a
rebasing glitch.
Found when doing the first attempt to build PySide
on PyPy with Windows :)
Task-number: PYSIDE-535
Change-Id: Ic0b6167bc08c9da8e0d34d6ef2d5b71c8ee548c1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 82219d035526f2e587db3adc90c03d4901bfba77)
-rw-r--r-- | sources/shiboken6/libshiboken/pep384impl.cpp | 32 | ||||
-rw-r--r-- | sources/shiboken6/libshiboken/pep384impl.h | 11 | ||||
-rw-r--r-- | sources/shiboken6/libshiboken/pep384impl_doc.rst | 7 | ||||
-rw-r--r-- | sources/shiboken6/libshiboken/sbkarrayconverter.cpp | 2 |
4 files changed, 1 insertions, 51 deletions
diff --git a/sources/shiboken6/libshiboken/pep384impl.cpp b/sources/shiboken6/libshiboken/pep384impl.cpp index 2722510af..4bf19e629 100644 --- a/sources/shiboken6/libshiboken/pep384impl.cpp +++ b/sources/shiboken6/libshiboken/pep384impl.cpp @@ -320,38 +320,6 @@ _PepUnicode_AsString(PyObject *str) /***************************************************************************** * - * Support for longobject.h - * - */ -#ifdef Py_LIMITED_API - -/* - * This is the original Python function _PyLong_AsInt() from longobject.c . - * We define it here because we are not allowed to use the function - * from Python with an underscore. - */ - -/* Get a C int from an int object or any object that has an __int__ - method. Return -1 and set an error if overflow occurs. */ - -int -_PepLong_AsInt(PyObject *obj) -{ - int overflow; - long result = PyLong_AsLongAndOverflow(obj, &overflow); - if (overflow || result > INT_MAX || result < INT_MIN) { - /* XXX: could be cute and give a different - message for overflow == -1 */ - PyErr_SetString(PyExc_OverflowError, - "Python int too large to convert to C int"); - return -1; - } - return int(result); -} -#endif // Py_LIMITED_API - -/***************************************************************************** - * * Support for pydebug.h * */ diff --git a/sources/shiboken6/libshiboken/pep384impl.h b/sources/shiboken6/libshiboken/pep384impl.h index cd62fbdc6..92509ec17 100644 --- a/sources/shiboken6/libshiboken/pep384impl.h +++ b/sources/shiboken6/libshiboken/pep384impl.h @@ -185,17 +185,6 @@ LIBSHIBOKEN_API const char *PepType_GetNameStr(PyTypeObject *type); /***************************************************************************** * - * RESOLVED: longobject.h - * - */ -#ifdef Py_LIMITED_API -LIBSHIBOKEN_API int _PepLong_AsInt(PyObject *); -#else -#define _PepLong_AsInt _PyLong_AsInt -#endif - -/***************************************************************************** - * * RESOLVED: pydebug.h * */ diff --git a/sources/shiboken6/libshiboken/pep384impl_doc.rst b/sources/shiboken6/libshiboken/pep384impl_doc.rst index 4e50d68e1..9ee74a26c 100644 --- a/sources/shiboken6/libshiboken/pep384impl_doc.rst +++ b/sources/shiboken6/libshiboken/pep384impl_doc.rst @@ -53,13 +53,6 @@ It is questionable if it is worthwhile to continue using the buffer protocol or if we should try to get rid of ``Pep_buffer``, completely. -longobject.h ------------- - -``_PyLong_AsInt`` is not available. We defined a ``_PepLong_AsInt`` function, instead. -Maybe this should be replaced by ``PyLong_AsLong``. - - pydebug.h --------- diff --git a/sources/shiboken6/libshiboken/sbkarrayconverter.cpp b/sources/shiboken6/libshiboken/sbkarrayconverter.cpp index 58d58d25c..3960295aa 100644 --- a/sources/shiboken6/libshiboken/sbkarrayconverter.cpp +++ b/sources/shiboken6/libshiboken/sbkarrayconverter.cpp @@ -157,7 +157,7 @@ static void sequenceToCppIntArray(PyObject *pyIn, void *cppOut) { auto *handle = reinterpret_cast<ArrayHandle<int> *>(cppOut); handle->allocate(PySequence_Size(pyIn)); - convertPySequence(pyIn, _PepLong_AsInt, handle->data()); + convertPySequence(pyIn, PyLong_AsLong, handle->data()); } static PythonToCppFunc sequenceToCppIntArrayCheck(PyObject *pyIn, int dim1, int /* dim2 */) |