Skip to content

Use of deprecated function PyEval_CallObject breaks build of Python wrapper on Python 3.13 #214

@h4vismat

Description

@h4vismat

The current implementation of swig_green_gdk.i for the Python SWIG calls PyEval_CallObject(), which has been deprecated since Python 3.9. This effectively breaks the build for the Python wrapper, as these functions are not defined anymore in Python 3.13. To keep up with the current CPython implementation, this needs to be addressed.

 3359 |     handler = PyEval_CallObject(handler_ref, NULL);
      |               ^
swig_green_gdk_wrap.c:3359:13: error: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
 3359 |     handler = PyEval_CallObject(handler_ref, NULL);
      |             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
swig_green_gdk_wrap.c:3369:13: error: incompatible integer to pointer conversion assigning to 'PyObject *' (aka 'struct _object *') from 'int' [-Wint-conversion]
 3369 |         ret = PyEval_CallObject(handler, args);
      |             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3 errors generated.
error: command '/usr/bin/clang' failed with exit code 1

ERROR Backend subprocess exited when trying to invoke build_wheel
make[3]: *** [src/swig_python/python-wheel-canary-file] Error 1
make[2]: *** [src/swig_python/CMakeFiles/python-wheel.dir/all] Error 2
make[1]: *** [src/swig_python/CMakeFiles/python-wheel.dir/rule] Error 2
make: *** [python-wheel] Error 2

After Python 3.9, the correct function to be used is PyObject_CallObject(), as defined on the Python 3.9 what's new page, and on the following CPython PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions