STINNER Victor <vstin...@redhat.com> added the comment:

I decided to work on this issue while trying to convert the 
_PyObject_GC_TRACK() macro into a "static inline" function. Currently, the 
macro uses _PyGC_generation0 which is defined earlier by "extern PyGC_Head 
*_PyGC_generation0;".

Problem: _PyGC_generation0 no longer exists... Include/internal/mem.h now 
defines: "#define _PyGC_generation0 _PyRuntime.gc.generation0".

Include/internal/mem.h includes Include/objimpl.h, but Include/objimpl.h 
requires Include/internal/mem.h. The include order matters here, many header 
files are inter-dependent, and have two header files with the same name in 
Include/ and Include/internal/ causes issues depending where the #include is 
done...

My PR renames mem.h to pycore_objimpl.h and include pycore_objimpl.h at "the 
right place" in objimpl.h. Since objimpl.h controls where pycore_objimpl.h is 
imported, it's simpler to handle inter-dependencies simpler.

Some inter-dependencies issues are hidden by the fact the C macros don't really 
require functions, macros and variables in the right order. They "just work". 
But converting C macros to proper "static inline" functions expose many issues.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35081>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to