]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-112305: Fix check-clean-src to detect frozen_modules .h files. (GH-113344...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 21 Dec 2023 07:47:20 +0000 (08:47 +0100)
committerGitHub <noreply@github.com>
Thu, 21 Dec 2023 07:47:20 +0000 (07:47 +0000)
gh-112305: Fix check-clean-src to detect frozen_modules .h files. (GH-113344)

A typo left this check broken so many of us who do out-of-tree builds
were seeing strange failures due to bad `Python/frozen_modules/*.h`
files being picked up from the source tree and used at build time from
different Python versions leading to errors like:

`Fatal Python error: _PyImport_InitCore: failed to initialize importlib`

Or similar once our build got to an "invoke the interpreter"
bootstrapping step due to incorrect bytecode being embedded.
(cherry picked from commit 103c4ea27464cef8d1793dab347f5ff3629dc243)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Makefile.pre.in
Misc/NEWS.d/next/Build/2023-12-21-05-35-06.gh-issue-112305.VfqQPx.rst [new file with mode: 0644]

index 41d3f330b33e0b25176e3bb1ca45e88135803d4b..2a0b850aaa3f0203fdf98df280419e4dcfe359eb 100644 (file)
@@ -594,11 +594,13 @@ check-clean-src:
        @if test -n "$(VPATH)" -a \( \
            -f "$(srcdir)/$(BUILDPYTHON)" \
            -o -f "$(srcdir)/Programs/python.o" \
-           -o -f "$(srcdir)\Python/frozen_modules/importlib._bootstrap.h" \
+           -o -f "$(srcdir)/Python/frozen_modules/importlib._bootstrap.h" \
        \); then \
                echo "Error: The source directory ($(srcdir)) is not clean" ; \
                echo "Building Python out of the source tree (in $(abs_builddir)) requires a clean source tree ($(abs_srcdir))" ; \
-               echo "Try to run: make -C \"$(srcdir)\" clean" ; \
+               echo "Build artifacts such as .o files, executables, and Python/frozen_modules/*.h must not exist within $(srcdir)." ; \
+               echo "Try to run:" ; \
+               echo "  (cd \"$(srcdir)\" && make clean || git clean -fdx -e Doc/venv)" ; \
                exit 1; \
        fi
 
diff --git a/Misc/NEWS.d/next/Build/2023-12-21-05-35-06.gh-issue-112305.VfqQPx.rst b/Misc/NEWS.d/next/Build/2023-12-21-05-35-06.gh-issue-112305.VfqQPx.rst
new file mode 100644 (file)
index 0000000..2df3207
--- /dev/null
@@ -0,0 +1,3 @@
+Fixed the ``check-clean-src`` step performed on out of tree builds to detect
+errant ``$(srcdir)/Python/frozen_modules/*.h`` files and recommend
+appropriate source tree cleanup steps to get a working build again.