Skip to content

Commit

Permalink
pythongh-112305: Fix check-clean-src to detect frozen_modules .h file…
Browse files Browse the repository at this point in the history
…s. (python#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.
  • Loading branch information
gpshead authored and aisk committed Feb 11, 2024
1 parent 1932de3 commit 1b910e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -657,11 +657,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

Expand Down
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 1b910e9

Please sign in to comment.