Skip to content

Commit f2cdc33

Browse files
jcfrmrbean-bremen
authored andcommitted
chore(PythonQt): replace PyInt_AsLong with PyLong_AsLong
No functional change intended.
1 parent 616294c commit f2cdc33

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/PythonQt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@ int custom_system_exit_exception_handler()
16571657
just let the else clause below print the error. */
16581658
}
16591659
if (PyLong_Check(value))
1660-
exitcode = (int)PyInt_AsLong(value);
1660+
exitcode = (int)PyLong_AsLong(value);
16611661
else {
16621662
PyObject *sys_stderr = PySys_GetObject(const_cast<char*>("stderr"));
16631663
if (sys_stderr != nullptr && sys_stderr != Py_None) {

src/PythonQtConversion.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ void* PythonQtConv::handlePythonToQtAutoConversion(int typeId, PyObject* obj, vo
313313
if (typeId == cursorId) {
314314
static PyObject* qtCursorShapeEnum = PythonQtClassInfo::findEnumWrapper("Qt::CursorShape", nullptr);
315315
if ((PyObject*)obj->ob_type == qtCursorShapeEnum) {
316-
Qt::CursorShape val = (Qt::CursorShape)PyInt_AsLong(obj);
316+
Qt::CursorShape val = (Qt::CursorShape)PyLong_AsLong(obj);
317317
if (!ptr) {
318318
PythonQtArgumentFrame_ADD_VARIANT_VALUE(frame, QCursor(), ptr);
319319
ptr = (void*)((QVariant*)ptr)->constData();
@@ -325,7 +325,7 @@ void* PythonQtConv::handlePythonToQtAutoConversion(int typeId, PyObject* obj, vo
325325
// brushes can be created from QColor and from Qt::GlobalColor (and from brushes, but that's the default)
326326
static PyObject* qtColorClass = PythonQt::priv()->getClassInfo("QColor")->pythonQtClassWrapper();
327327
if ((PyObject*)obj->ob_type == qtGlobalColorEnum) {
328-
Qt::GlobalColor val = (Qt::GlobalColor)PyInt_AsLong(obj);
328+
Qt::GlobalColor val = (Qt::GlobalColor)PyLong_AsLong(obj);
329329
if (!ptr) {
330330
PythonQtArgumentFrame_ADD_VARIANT_VALUE(frame, QPen(), ptr);
331331
ptr = (void*)((QVariant*)ptr)->constData();
@@ -344,7 +344,7 @@ void* PythonQtConv::handlePythonToQtAutoConversion(int typeId, PyObject* obj, vo
344344
// brushes can be created from QColor and from Qt::GlobalColor (and from brushes, but that's the default)
345345
static PyObject* qtColorClass = PythonQt::priv()->getClassInfo("QColor")->pythonQtClassWrapper();
346346
if ((PyObject*)obj->ob_type == qtGlobalColorEnum) {
347-
Qt::GlobalColor val = (Qt::GlobalColor)PyInt_AsLong(obj);
347+
Qt::GlobalColor val = (Qt::GlobalColor)PyLong_AsLong(obj);
348348
if (!ptr) {
349349
PythonQtArgumentFrame_ADD_VARIANT_VALUE(frame, QBrush(), ptr);
350350
ptr = (void*)((QVariant*)ptr)->constData();
@@ -362,7 +362,7 @@ void* PythonQtConv::handlePythonToQtAutoConversion(int typeId, PyObject* obj, vo
362362
} else if (typeId == colorId) {
363363
// colors can be created from Qt::GlobalColor (and from colors, but that's the default)
364364
if ((PyObject*)obj->ob_type == qtGlobalColorEnum) {
365-
Qt::GlobalColor val = (Qt::GlobalColor)PyInt_AsLong(obj);
365+
Qt::GlobalColor val = (Qt::GlobalColor)PyLong_AsLong(obj);
366366
if (!ptr) {
367367
PythonQtArgumentFrame_ADD_VARIANT_VALUE(frame, QColor(), ptr);
368368
ptr = (void*)((QVariant*)ptr)->constData();
@@ -903,8 +903,8 @@ int PythonQtConv::PyObjGetInt(PyObject* val, bool strict, bool &ok) {
903903
d = 1;
904904
} else {
905905
PyErr_Clear();
906-
// PyInt_AsLong will try conversion to an int if the object is not an int:
907-
d = PyInt_AsLong(val);
906+
// PyLong_AsLong will try conversion to an int if the object is not an int:
907+
d = PyLong_AsLong(val);
908908
if (PyErr_Occurred()) {
909909
ok = false;
910910
PyErr_Clear();

src/PythonQtPythonInclude.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@
126126
#define PyString_FromFormat PyUnicode_FromFormat
127127
#define PyString_Check PyUnicode_Check
128128

129-
#define PyInt_AsLong PyLong_AsLong
130-
131129
#else
132130
// Defines to use Python 3 names in Python 2 code
133131
#define PyBytes_Type PyString_Type

0 commit comments

Comments
 (0)