Skip to content

Commit 13e5d43

Browse files
committed
bpo-45950: Attempt to fix macOS builds of _bootstrap_python when using framework
1 parent 98fac8b commit 13e5d43

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

Makefile.pre.in

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,9 +954,9 @@ BOOTSTRAP_HEADERS = \
954954

955955
Programs/_bootstrap_python.o: Programs/_bootstrap_python.c $(BOOTSTRAP_HEADERS) $(PYTHON_HEADERS)
956956

957-
_bootstrap_python: $(LIBRARY_OBJS_OMIT_FROZEN) Programs/_bootstrap_python.o Modules/getpath.o Modules/Setup.local
957+
_bootstrap_python: $(LIBRARY_OBJS_OMIT_FROZEN) Programs/_bootstrap_python.o Modules/getpath_bootstrap.o Modules/Setup.local
958958
$(LINKCC) $(PY_LDFLAGS_NOLTO) -o $@ $(LIBRARY_OBJS_OMIT_FROZEN) \
959-
Programs/_bootstrap_python.o Modules/getpath.o $(LIBS) $(MODLIBS) $(SYSLIBS)
959+
Programs/_bootstrap_python.o Modules/getpath_bootstrap.o $(LIBS) $(MODLIBS) $(SYSLIBS)
960960

961961
############################################################################
962962
# Deepfreeze targets
@@ -1205,6 +1205,18 @@ Modules/getpath.o: $(srcdir)/Modules/getpath.c Python/frozen_modules/getpath.h M
12051205
-DPLATLIBDIR='"$(PLATLIBDIR)"' \
12061206
-o $@ $(srcdir)/Modules/getpath.c
12071207

1208+
# like getpath.o with additional -DPY_BOOTSTRAP_PYTHON=1
1209+
Modules/getpath_bootstrap.o: $(srcdir)/Modules/getpath.c Python/frozen_modules/getpath.h Makefile $(PYTHON_HEADERS)
1210+
$(CC) -c $(PY_CORE_CFLAGS) -DPYTHONPATH='"$(PYTHONPATH)"' \
1211+
-DPREFIX='"$(prefix)"' \
1212+
-DEXEC_PREFIX='"$(exec_prefix)"' \
1213+
-DVERSION='"$(VERSION)"' \
1214+
-DVPATH='"$(VPATH)"' \
1215+
-DPLATLIBDIR='"$(PLATLIBDIR)"' \
1216+
-DPY_BOOTSTRAP_PYTHON=1 \
1217+
-o $@ $(srcdir)/Modules/getpath.c
1218+
1219+
12081220
Programs/python.o: $(srcdir)/Programs/python.c
12091221
$(MAINCC) -c $(PY_CORE_CFLAGS) -o $@ $(srcdir)/Programs/python.c
12101222

Modules/getpath.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,8 @@ library_to_dict(PyObject *dict, const char *key)
754754
if (PyWin_DLLhModule) {
755755
return winmodule_to_dict(dict, key, PyWin_DLLhModule);
756756
}
757-
#elif defined(WITH_NEXT_FRAMEWORK)
757+
#elif defined(WITH_NEXT_FRAMEWORK) && !defined(PY_BOOTSTRAP_PYTHON)
758+
// _bootstrap_python does not use framework and crashes
758759
static const char modPath[MAXPATHLEN + 1];
759760
static int modPathInitialized = -1;
760761
if (modPathInitialized < 0) {

0 commit comments

Comments
 (0)