X Tutup
The Wayback Machine - https://web.archive.org/web/20260104162139/https://github.com/python/cpython/issues/105813
Skip to content

Namespace Autoconf preprocessor defines #105813

@erlend-aasland

Description

@erlend-aasland

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

Metadata

Metadata

Labels

buildThe build process and cross-buildtype-featureA feature request or enhancement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    X Tutup