Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 682c04c

Browse files
committed
Issue #21166: merge from 3.4
2 parents d0aeda8 + fcbc246 commit 682c04c

4 files changed

Lines changed: 20 additions & 1 deletion

File tree

Makefile.pre.in

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,18 @@ platform: $(BUILDPYTHON) pybuilddir.txt
553553
# Create build directory and generate the sysconfig build-time data there.
554554
# pybuilddir.txt contains the name of the build dir and is used for
555555
# sys.path fixup -- see Modules/getpath.c.
556+
# Since this step runs before shared modules are built, try to avoid bootstrap
557+
# problems by creating a dummy pybuildstr.txt just to allow interpreter
558+
# initialization to succeed. It will be overwritten by generate-posix-vars
559+
# or removed in case of failure.
556560
pybuilddir.txt: $(BUILDPYTHON)
557-
$(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars
561+
@echo "none" > ./pybuilddir.txt
562+
$(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars ;\
563+
if test $$? -ne 0 ; then \
564+
echo "generate-posix-vars failed" ; \
565+
rm -f ./pybuilddir.txt ; \
566+
exit 1 ; \
567+
fi
558568

559569
# Build the shared modules
560570
# Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,9 @@ Build
825825

826826
- Issue #21811: Anticipated fixes to support OS X versions > 10.9.
827827

828+
- Issue #21166: Prevent possible segfaults and other random failures of
829+
python --generate-posix-vars in pybuilddir.txt build target.
830+
828831
C API
829832
-----
830833

configure

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2954,6 +2954,9 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
29542954

29552955

29562956

2957+
# pybuilddir.txt will be created by --generate-posix-vars in the Makefile
2958+
rm -f pybuilddir.txt
2959+
29572960
if test "$cross_compiling" = yes; then
29582961
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter for cross build" >&5
29592962
$as_echo_n "checking for python interpreter for cross build... " >&6; }

configure.ac

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ AC_CANONICAL_HOST
5353
AC_SUBST(build)
5454
AC_SUBST(host)
5555

56+
# pybuilddir.txt will be created by --generate-posix-vars in the Makefile
57+
rm -f pybuilddir.txt
58+
5659
if test "$cross_compiling" = yes; then
5760
AC_MSG_CHECKING([for python interpreter for cross build])
5861
if test -z "$PYTHON_FOR_BUILD"; then

0 commit comments

Comments
 (0)