[WIP] bpo-35081: _testcapi is now compiled with Py_BUILD_CORE by vstinner · Pull Request #10274 · python/cpython (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation5 Commits1 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
- setup.py now defines Py_BUILD_CORE to build the _testcapi module
(_testcapimodule.c). - pycore_pathconfig.h now requires Py_BUILD_CORE to be defined.
https://bugs.python.org/issue35081
- setup.py now defines Py_BUILD_CORE to build the _testcapi module (_testcapimodule.c).
- pycore_pathconfig.h now requires Py_BUILD_CORE to be defined.
IHMO this PR depends on PR #10238 to properly define datetime.h when compiling with Py_BUILD_CORE.
Is not intended to build it without Py_BUILD_CORE for testing the same C API that is available in external extensions?
Is not intended to build it without Py_BUILD_CORE for testing the same C API that is available in external extensions?
Honestly, the exact purpose of _testcapi is now unclear to me :-) This module became giant. Maybe we need a new module to the test the Py_BUILD_CORE API? _testcapi.get_coreconfig() converts PyInterpreterState.core_config to a Python function, from my point of view, this code is not part of the public Python C API.
--
Other options:
- Copy/paste _Py_wstrlist_as_pylist() function from main.c to _testcapimodule.c: I would prefer to not duplicate code!
- Move get_coreconfig() from _testcapimodule.c to coreconfig.c: But this function is only used for an unit test (at least, now ;-)), so I would prefer to not always compile the function in Python binary (or in libpython), not waste memory/disk space.
I'm going to split _testcapi.c
onto several parts and move them into the new Modules/_testcapi/
directory (similarly to Modules/_io/
). I'm working on adding tests for C API, and this adds too much code in _testcapi.c
, so it is practical to add separate files for helpers for testing different parts of C API.
If the only problem is with _Py_wstrlist_as_pylist()
, the simplest temporary workaround is to duplicate its declaration in _testcapi.c
.
Is not intended to build it without Py_BUILD_CORE for testing the same C API that is available in external extensions?
Right. I abandon this PR and wrote PR #10362 which is the proper fix: it also ensures that _testcapimodule.c is not compiled with Py_BUILD_CORE defined.