Skip to content

gh-109723: Disable Py_BUILD_CORE in _testcapi - #109727

Merged
vstinner merged 2 commits into
python:mainfrom
vstinner:testcapi_disable_core
Sep 22, 2023
Merged

vstinner merged 2 commits into
python:mainfrom
vstinner:testcapi_disable_core

Conversation

@vstinner

@vstinner vstinner commented Sep 22, 2023 •

Copy link
Copy Markdown
Member

Make sure that the internal C API is not tested by mistake by _testcapi.

Undefine Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE macros in Modules/_testcapi/parts.h: move code from _testcapimodule.c.

heaptype_relative.c and vectorcall_limited.c are using the limited C API which is incompatible with the internal C API.

Move test_long_numbits() from _testcapi to _testinternalcapi since it uses the internal C API "pycore_long.h".

Fix Modules/_testcapi/pyatomic.c: don't include Python.h directly, just include _testcapi/parts.h.

Make sure that the internal C API is not tested by mistake by
_testcapi.

Undefine Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE macros in
Modules/_testcapi/parts.h: move code from _testcapimodule.c.

heaptype_relative.c and vectorcall_limited.c are using the limited C
API which is incompatible with the internal C API.

Move test_long_numbits() from _testcapi to _testinternalcapi since it
uses the internal C API "pycore_long.h".

Fix Modules/_testcapi/pyatomic.c: don't include Python.h directly,
just include _testcapi/parts.h.
@vstinner
vstinner force-pushed the testcapi_disable_core branch from 2ce1e72 to ee89db4 Compare September 22, 2023 12:56
@vstinner
vstinner enabled auto-merge (squash) September 22, 2023 13:22
@vstinner

Copy link
Copy Markdown
Member Author
@vstinner
vstinner merged commit 09a2561 into python:main Sep 22, 2023
@vstinner
vstinner deleted the testcapi_disable_core branch September 22, 2023 14:54
@vstinner

Copy link
Copy Markdown
Member Author

Oh. I'm not sure that my fix worked. A recent WASM build still failed with the fix :-(

In file included from ../../Modules/_testclinic_limited.c:7:
In file included from ../../Include/Python.h:44:
../../Include/pyport.h:52:4: error: "Py_LIMITED_API is not compatible with Py_BUILD_CORE"
#  error "Py_LIMITED_API is not compatible with Py_BUILD_CORE"
   ^
1 error generated.
emcc: error: 'ccache /opt/emsdk/upstream/bin/clang -target wasm32-unknown-emscripten -fignore-exceptions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -DEMSCRIPTEN -D__EMSCRIPTEN_major__=3 -D__EMSCRIPTEN_minor__=1 -D__EMSCRIPTEN_tiny__=22 -Werror=implicit-function-declaration -I/opt/buildbot/.emscripten_cache/sysroot/include/SDL --sysroot=/opt/buildbot/.emscripten_cache/sysroot -Xclang -iwithsysroot/include/compat -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -g3 -O3 -Wall -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I../../Include/internal -IObjects -IInclude -IPython -I. -I../../Include -fPIC -DPy_BUILD_CORE_BUILTIN -c ../../Modules/_testclinic_limited.c -o Modules/_testclinic_limited.o' failed (returned 1)
make: *** [Makefile:3086: Modules/_testclinic_limited.o] Error 1
make: *** Waiting for unfinished jobs....
emmake: error: 'make -j2 all' failed (returned 2)

build: https://buildbot.python.org/all/#/builders/1056/builds/3146

csm10495 pushed a commit to csm10495/cpython that referenced this pull request Sep 28, 2023
Make sure that the internal C API is not tested by mistake by
_testcapi.

Undefine Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE macros in
Modules/_testcapi/parts.h: move code from _testcapimodule.c.

heaptype_relative.c and vectorcall_limited.c are using the limited C
API which is incompatible with the internal C API.

Move test_long_numbits() from _testcapi to _testinternalcapi since it
uses the internal C API "pycore_long.h".

Fix Modules/_testcapi/pyatomic.c: don't include Python.h directly,
just include _testcapi/parts.h.

Ajust "make check-c-globals" for these changes.
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Make sure that the internal C API is not tested by mistake by
_testcapi.

Undefine Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE macros in
Modules/_testcapi/parts.h: move code from _testcapimodule.c.

heaptype_relative.c and vectorcall_limited.c are using the limited C
API which is incompatible with the internal C API.

Move test_long_numbits() from _testcapi to _testinternalcapi since it
uses the internal C API "pycore_long.h".

Fix Modules/_testcapi/pyatomic.c: don't include Python.h directly,
just include _testcapi/parts.h.

Ajust "make check-c-globals" for these changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant