cpython
cpython copied to clipboard
Test Limited API in _testcapi module
The Limited API is currently tested in xxlimited
module(s), which isn't a great location since the module serves as a “tutorial” example of how to make a module. There's no room for advanced stuff or edge cases.
Testing Limited API together with other C API is complicated, because:
- Limited API needs to be enabled per source file
- Some builds don't support Limited API, so Limited API tests must be skipped on those builds.
(Currently this is
Py_TRACE_REFS
, but that may change.) -
Py_LIMITED_API
must be defined before<Python.h>
is included.
With #95505 (splitting _testcapi
module into several source files), the first complication is solved. I'd like to add helpers for the others, to make testing Limited API easy.