bpo-45548: Some test modules must be built as shared libs (GH-29268)

Some test cases don't work when test modules are static extensions.

Add dependency on Modules/config.c to trigger a rebuild whenever a
module build type is changed.

``makesetup`` puts shared extensions into ``Modules/`` directory. Create
symlinks from pybuilddir so the extensions can be imported.

Note: It is not possible to use the content of pybuilddir.txt as a build
target. Makefile evaluates target variables in the first pass. The
pybuilddir.txt file does not exist at that point.
This commit is contained in:
Christian Heimes 2021-10-29 18:49:57 +03:00 committed by GitHub
parent d9575218d7
commit f0150ac94a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 13 deletions

View file

@ -297,14 +297,16 @@ xxsubtype xxsubtype.c # Required for the test suite to pass!
#_xxsubinterpreters _xxsubinterpretersmodule.c
#_xxtestfuzz _xxtestfuzz/_xxtestfuzz.c _xxtestfuzz/fuzzer.c
#_ctypes_test _ctypes/_ctypes_test.c
#_testbuffer _testbuffer.c
#_testimportmultiple _testimportmultiple.c
#_testinternalcapi _testinternalcapi.c
#_testmultiphase _testmultiphase.c
# Some testing modules MUST be built as shared libraries.
#*shared*
#_testcapi _testcapimodule.c # CANNOT be statically compiled!
#_ctypes_test _ctypes/_ctypes_test.c
#_testcapi _testcapimodule.c
#_testimportmultiple _testimportmultiple.c
#_testmultiphase _testmultiphase.c
# ---
# Uncommenting the following line tells makesetup that all following modules

View file

@ -241,7 +241,8 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
cc="$cc \$(PY_BUILTIN_MODULE_CFLAGS)";;
esac
mods_upper=$(echo $mods | tr '[a-z]' '[A-Z]')
rule="$obj: $src \$(MODULE_${mods_upper}_DEPS) \$(PYTHON_HEADERS); $cc $cpps -c $src -o $obj"
# force rebuild when header file or module build flavor (static/shared) is changed
rule="$obj: $src \$(MODULE_${mods_upper}_DEPS) \$(PYTHON_HEADERS) Modules/config.c; $cc $cpps -c $src -o $obj"
echo "$rule" >>$rulesf
done
case $doconfig in