# Make some number configure macros public in non-limited capi

**URL:** <https://discuss.python.org/t/make-some-number-configure-macros-public-in-non-limited-capi/109441>\
**Category:** Ideas\
**Created:** [October 12, 2026, 2:44am UTC](https://discuss.python.org/t/make-some-number-configure-macros-public-in-non-limited-capi/109441 "2026-10-12T02:44:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Locked-chess-official](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/locked-chess-official/32/27037_2.png) [@Locked-chess-official](https://discuss.python.org/u/Locked-chess-official)\
**Post date:** [October 12, 2026, 2:44am UTC](https://discuss.python.org/t/make-some-number-configure-macros-public-in-non-limited-capi/109441/1 "2026-10-12T02:44:06Z")

</div>

Some non-standard macros in pyconfig.h (like `SIZEOF_VOID_P` or `LONG_BIT`) are useful (for example, numpy use them). This idea is to make them public:

In `pyconfig.h.in`, change it to `_Py_*`  
In `Python.h` add the code like it to avoid the breaking-forward for normal build:

```c
#ifndef Py_LIMITED_API
#ifdef _Py_SIZEOF_VOID_P
#define Py_SIZEOF_VOID_P _Py_SIZEOF_VOID_P
#endif

// and any other number macros
#endif

```

---

<div class="post-metadata">

**Author:** ![vstinner](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/vstinner/32/15130_2.png) [@vstinner](https://discuss.python.org/u/vstinner)\
**Post date:** [October 12, 2026, 9:07am UTC](https://discuss.python.org/t/make-some-number-configure-macros-public-in-non-limited-capi/109441/2 "2026-10-12T09:07:29Z")

</div>

I don’t understand your request. `SIZEOF_VOID_P` is currently exposed by `<Python.h>`:

```python
$ cat x.c
#include <Python.h>

int main()
{
    return SIZEOF_VOID_P;
}

$ gcc x.c -o x $(pkg-config python-3.14 --cflags) && ./x; echo $?
8

```

I don’t understand your example: `#define Py_SIZEOF_VOID_P _Py_SIZEOF_VOID_P` defines a macro to.. itself? The new name is also private?

> [@Locked-chess-official](#):
>
> Some non-standard macros in pyconfig.h (like `SIZEOF_VOID_P` or `LONG_BIT`) are useful (for example, numpy use them).

I don’t think that it’s a good idea that developers rely on macros generated by Python configure script. These macros may disappear later if Python configure script evolves.

I don’t like the idea of making these macros more visible. I would prefer to discourage their usage. I implemented a check for that in Python 3.16: [https://github.com/python/cpython/issues/157695](https://github.com/python/cpython/issues/157695) makes sure that new macros have a name starting with `Py` (or `_Py` for private macros): don’t add more `HAVE_xxx` or `SIZEOF_xxx` macros. For example, Python 3.16 adds a private `_Py_HAVE_ACOSPI` macro (name starts with `_Py`): macro checking if `acospi()` function is available.

---

<div class="post-metadata">

**Author:** ![Locked-chess-official](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/locked-chess-official/32/27037_2.png) [@Locked-chess-official](https://discuss.python.org/u/Locked-chess-official)\
**Post date:** [October 12, 2026, 9:13am UTC](https://discuss.python.org/t/make-some-number-configure-macros-public-in-non-limited-capi/109441/3 "2026-10-12T09:13:18Z")

</div>

The new name `Py_SIZEOF_VOID_P` is public (won’t be exposed in limited capi). The `_Py_SIZEOF_VOID_P` is private (changed from `SIZEOF_VOID_P`).

A tricky question is why many extensions use them. Perhaps this is to coordinate with specific interpreters.
