Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
h4vismat opened this issue Jan 7, 2025 · 2 comments

Comments

@h4vismat
Copy link

h4vismat commented Jan 7, 2025

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.

@h4vismat
Copy link
Author

h4vismat commented Jan 7, 2025

I have already implemented a fix on the following PR: #215
Feel free to point out any considerations.

@jgriffiths
Copy link
Contributor

Fixed in master, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants