-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
3.12.0b1: static declaration follows non-static when importing internal/pycore_dict.h #105268
Comments
You are including internal headers which is not allowed. You should never define
Thus, you will never see this function: static inline int _PyGC_FINALIZED(PyObject *op) { Say if you are really relying on some internal things, make sure you have defined Then you will never see this definition: # define _PyGC_FINALIZED(o) PyObject_GC_IsFinalized(o) P.S. I have found no |
I really do need these internal structures. So this means that the fact it used to work for older versions of Python is just a mere accident. Correct? I'll try defining
The change with the |
CC @vstinner . |
Remove the old private, undocumented and untested _PyGC_FINALIZED() macro which was kept for backward compatibility with Python 3.8 and older.
It seems like the Well, this old macro is causing the trouble here. It should just be removed: I wrote PR #105350 for that. You should be able to work around the issue by defining the |
Remove the old private, undocumented and untested _PyGC_FINALIZED() macro which was kept for backward compatibility with Python 3.8 and older.
I removed the macro. Thanks for your reminder :-) I close the issue. |
* gcmodule.c reuses _Py_AS_GC(op) for AS_GC() * Move gcmodule.c FROM_GC() implementation to a new _Py_FROM_GC() static inline function in pycore_gc.h. * _PyObject_IS_GC(): only get the type once * gc_is_finalized(à) and PyObject_GC_IsFinalized() use _PyGC_FINALIZED(), instead of _PyGCHead_FINALIZED().
* gcmodule.c reuses _Py_AS_GC(op) for AS_GC() * Move gcmodule.c FROM_GC() implementation to a new _Py_FROM_GC() static inline function in pycore_gc.h. * _PyObject_IS_GC(): only get the type once * gc_is_finalized(à) and PyObject_GC_IsFinalized() use _PyGC_FINALIZED(), instead of _PyGCHead_FINALIZED(). * Remove _Py_CAST() in pycore_gc.h: this header file is not built with C++.
* gcmodule.c reuses _Py_AS_GC(op) for AS_GC() * Move gcmodule.c FROM_GC() implementation to a new _Py_FROM_GC() static inline function in pycore_gc.h. * _PyObject_IS_GC(): only get the type once * gc_is_finalized(à) and PyObject_GC_IsFinalized() use _PyGC_FINALIZED(), instead of _PyGCHead_FINALIZED(). * Remove _Py_CAST() in pycore_gc.h: this header file is not built with C++.
I would add to this issue that the PyTorch project is also heavily using partial Py_BUILD_CORE import. The removal of the macro fixes our build as well but wanted to add one more data point. |
Maybe you should open an issue to ask for a way to avoid Py_BUILD_CORE in PyTorch :-)
Hum, I didn't backport this change to Python 3.12. Maybe I should? Are you using Python 3.12 or the future 3.13? Can you patch Python? |
Ho I assumed it would make it to the rc even though it wasn't on b4. Backporting it would be amazing as other we will have to build the whole of PyTorch with Py_BUILD_CORE for 3.12 :/
Very happy to do that! Is the best place here on github or on the discuss forum? |
Remove the old private, undocumented and untested _PyGC_FINALIZED() macro which was kept for backward compatibility with Python 3.8 and older. (cherry picked from commit 8ddf0dd)
Remove the old private, undocumented and untested _PyGC_FINALIZED() macro which was kept for backward compatibility with Python 3.8 and older. (cherry picked from commit 8ddf0dd)
The change is not going to be backported to Python 3.12: #107348 The workaround is to first include <Python.h>, undefine _PyGC_FINALIZED macro ( Thanks for the bug report. |
Bug report
I have a change within a project that includes a native extension which fails to compile with 3.12.0b1:
I didn't look too deep into what changed here, but my guess would be that the macro should drop the
_
prefix, i.e.since it seems that
PyObject_GC_IsFinalized
is part of the API. The same code compiles fine with older versions of Python.Your environment
MacOS Ventura 13.3.1
Python 3.12.0b1
Linked PRs
The text was updated successfully, but these errors were encountered: