File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -546,8 +546,18 @@ platform: $(BUILDPYTHON) pybuilddir.txt
546546# Create build directory and generate the sysconfig build-time data there.
547547# pybuilddir.txt contains the name of the build dir and is used for
548548# sys.path fixup -- see Modules/getpath.c.
549+ # Since this step runs before shared modules are built, try to avoid bootstrap
550+ # problems by creating a dummy pybuildstr.txt just to allow interpreter
551+ # initialization to succeed. It will be overwritten by generate-posix-vars
552+ # or removed in case of failure.
549553pybuilddir.txt: $(BUILDPYTHON)
550- $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars
554+ @echo "none" > ./pybuilddir.txt
555+ $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\
556+ if test $$? -ne 0 ; then \
557+ echo "generate-posix-vars failed" ; \
558+ rm -f ./pybuilddir.txt ; \
559+ exit 1 ; \
560+ fi
551561
552562# Build the shared modules
553563# Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
Original file line number Diff line number Diff line change @@ -242,6 +242,9 @@ Build
242242
243243- Issue #21811: Anticipated fixes to support OS X versions > 10.9.
244244
245+ - Issue #21166: Prevent possible segfaults and other random failures of
246+ python --generate-posix-vars in pybuilddir.txt build target.
247+
245248IDLE
246249----
247250
Original file line number Diff line number Diff line change @@ -2950,6 +2950,9 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
29502950
29512951
29522952
2953+ # pybuilddir.txt will be created by --generate-posix-vars in the Makefile
2954+ rm -f pybuilddir.txt
2955+
29532956if test " $cross_compiling " = yes; then
29542957 { $as_echo " $as_me :${as_lineno-$LINENO } : checking for python interpreter for cross build" >&5
29552958$as_echo_n " checking for python interpreter for cross build... " >&6 ; }
Original file line number Diff line number Diff line change @@ -53,6 +53,9 @@ AC_CANONICAL_HOST
5353AC_SUBST ( build )
5454AC_SUBST ( host )
5555
56+ # pybuilddir.txt will be created by --generate-posix-vars in the Makefile
57+ rm -f pybuilddir.txt
58+
5659if test "$cross_compiling" = yes; then
5760 AC_MSG_CHECKING ( [ for python interpreter for cross build] )
5861 if test -z "$PYTHON_FOR_BUILD"; then
You can’t perform that action at this time.
0 commit comments