[issue42784] issues with object.h includes

STINNER Victor report at bugs.python.org
Mon Jan 31 12:13:32 EST 2022


STINNER Victor <vstinner at python.org> added the comment:

There is an on-going work to move more and more header files into Include/cpython/ subdirectory, or even to the Include/internal/ directory. Examples:

* bpo-35134: Move cellobject.h, classobject.h, context.h, funcobject.h, genobject.h and longintrepr.h to Include/cpython/
* bpo-45434: Move pystrhex.h to Include/internal/

C extensions must only use #include "Python.h":
https://docs.python.org/dev/c-api/intro.html#api-includes

Sadly, many project include directly "inner" header files like "longobject.h" and so this ong-going work break a few projects at each Python 3.x release.

In the meanwhile, you can reorder your include paths to put your project first, or rename object.h to different filename.

---

Yeah, if it wouldn't break any C extension, I would prefer to "hide" all "inner" files under a sub-directory, or by renaming them. But right now, it's possible.

----------
nosy: +vstinner

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42784>
_______________________________________


More information about the Python-bugs-list mailing list