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 Boost's include wrapper for Python.h, and use python includes before any system includes #142

Open
SwooshyCueb opened this issue May 22, 2023 · 1 comment
Assignees

Comments

@SwooshyCueb
Copy link
Member

According to Boost's documentation, we shouldn't be #includeing Python.h directly:

If you should ever have occasion to #include "python.h" directly in a translation unit of a program using Boost.Python, use #include "boost/python/detail/wrap_python.hpp" instead. It handles several issues necessary for use with Boost.Python...

Additionally, we are to ensure that any Python headers are included before system/platform headers.

From Boost's documentation:

Be sure not to #include any system headers before wrap_python.hpp. This restriction is actually imposed by Python, or more properly, by Python's interaction with your operating system.

From Python's documentation:

Since Python may define some pre-processor definitions which affect the standard headers on some systems, you must include Python.h before any standard headers are included.

@korydraughn
Copy link
Contributor

Excellent find.

@SwooshyCueb SwooshyCueb changed the title Use Boost's include wrapper for Python.h, and use it before any system includes Use Boost's include wrapper for Python.h, and use python includes before any system includes May 22, 2023
@SwooshyCueb SwooshyCueb self-assigned this May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants