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

Namespace Autoconf preprocessor defines #105813

Open
6 tasks
erlend-aasland opened this issue Jun 15, 2023 · 0 comments
Open
6 tasks

Namespace Autoconf preprocessor defines #105813

erlend-aasland opened this issue Jun 15, 2023 · 0 comments
Assignees
Labels
build The build process and cross-build type-feature A feature request or enhancement

Comments

@erlend-aasland
Copy link
Contributor

erlend-aasland commented Jun 15, 2023

Quoting from capi-workgroup/problems#46:

The headers define a number of identifiers that don't start with Py (or _Py), potentially clashing with other code.

[...]

  • configure cruft like HAVE_STRFTIM or SIZEOF_SIZE_T

We can add an m4 macro that wraps AC_DEFINE and AH_TEMPLATE, to make sure we namespace any defines produced by configure. I'm not sure how PEP-387 plays in here; can we simply change these preprocessor defines? I guess not, since what's exposed in Python.h is protected by PEP-387. For now, let's just add macros that add properly namespaced defined in addition to the existing ones.

  • Add macros that add Py_ namespaced defined in addition to the existing defs
    • Add PY_DEFINE macro that wraps AC_DEFINE
    • Add PY_TEMPLATE macro that wraps AH_TEMPLATE
    • Add PY_CHECK_HEADERS macro that wraps AC_CHECK_HEADERS
    • Use these macros in configure.ac
  • Remove the old non-namespaced defs

Linked PRs

@erlend-aasland erlend-aasland added type-feature A feature request or enhancement build The build process and cross-build labels Jun 15, 2023
@erlend-aasland erlend-aasland self-assigned this Jun 15, 2023
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Feb 12, 2024
Add AC_DEFINE_*() wrapper that adds Py_ namespaced macros in addition to
the existing ones.
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Feb 14, 2024
Add AC_DEFINE_*() wrapper that adds Py_ namespaced macros in addition to
the existing ones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant