This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: issues with object.h includes
Type: compile error Stage: resolved
Components: C API Versions: Python 3.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: bigbossbro08, iritkatriel, vstinner
Priority: normal Keywords:

Created on 2020-12-30 07:44 by bigbossbro08, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg384050 - (view) Author: Big Boss (bigbossbro08) Date: 2020-12-30 07:44
using #include <object.h> in header files is known to cause conflict with other projects using similar <object.h> header file. Best workaround should be renaming to <pyobject.h>. Probably better to do the same thing to other header files as well. Or wrap it around with a folder. Like <utils/object.h>
msg412211 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-01-31 17:13
Another workaround is for you to rename object.h in your project.
msg412212 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-01-31 17:13
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.
History
Date User Action Args
2022-04-11 14:59:39adminsetgithub: 86950
2022-01-31 17:13:32vstinnersetnosy: + vstinner
messages: + msg412212
2022-01-31 17:13:05iritkatrielsetstatus: open -> closed

nosy: + iritkatriel
messages: + msg412211

resolution: rejected
stage: resolved
2020-12-30 07:44:25bigbossbro08create