Closed
Description
Feature or enhancement
Currently, the C API implements many constants as macros. Examples:
#define Py_False _PyObject_CAST(&_Py_FalseStruct)
#define Py_None (&_Py_NoneStruct)
I propose to export important constants as symbols in the stable ABI and the limited C API, but still implement them as macros in the non-limited C API.
Linked PRs
- gh-115754: Export Py_None, Py_False, Py_True as symbols #115755
- gh-115754: Get singletons via function calls #116572
- gh-115754: Add Py_GetConstantRef() function #116883
- gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) #125194
- gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_BYTES) #125195
- gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_BYTES) #125581
- gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) #125583