Skip to content

Commit 063db62

Browse files
xdegayencoghlan
authored andcommitted
bpo-32232: by default, Setup modules are no longer built with -DPy_BUILD_CORE (GH-6489)
Setup modules are no longer built with -DPy_BUILD_CORE by default, as using that flag may now require including additional internal-only header files. Instead, only the modules that specifically need it use that setting.
1 parent d70c2a6 commit 063db62

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed

Makefile.pre.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ ARFLAGS= @ARFLAGS@
106106
# Extra C flags added for building the interpreter object files.
107107
CFLAGSFORSHARED=@CFLAGSFORSHARED@
108108
# C flags used for building the interpreter object files
109-
PY_CORE_CFLAGS= $(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
109+
PY_STDMODULE_CFLAGS= $(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED)
110+
PY_CORE_CFLAGS= $(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE
110111
# Strict or non-strict aliasing flags used to compile dtoa.c, see above
111112
CFLAGS_ALIASING=@CFLAGS_ALIASING@
112113

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
By default, modules configured in `Modules/Setup` are no longer built with
2+
`-DPy_BUILD_CORE`. Instead, modules that specifically need that preprocessor
3+
definition include it in their individual entries.

Modules/Setup.dist

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -104,33 +104,33 @@ PYTHONPATH=$(COREPYTHONPATH)
104104
# This only contains the minimal set of modules required to run the
105105
# setup.py script in the root of the Python source tree.
106106

107-
posix posixmodule.c # posix (UNIX) system calls
108-
errno errnomodule.c # posix (UNIX) errno values
109-
pwd pwdmodule.c # this is needed to find out the user's home dir
110-
# if $HOME is not set
111-
_sre _sre.c # Fredrik Lundh's new regular expressions
112-
_codecs _codecsmodule.c # access to the builtin codecs and codec registry
113-
_weakref _weakref.c # weak references
114-
_functools _functoolsmodule.c # Tools for working with functions and callable objects
115-
_operator _operator.c # operator.add() and similar goodies
116-
_collections _collectionsmodule.c # Container types
117-
_abc _abc.c # Abstract base classes
118-
itertools itertoolsmodule.c # Functions creating iterators for efficient looping
119-
atexit atexitmodule.c # Register functions to be run at interpreter-shutdown
120-
_signal signalmodule.c
121-
_stat _stat.c # stat.h interface
122-
time timemodule.c # -lm # time operations and variables
123-
_thread _threadmodule.c # low-level threading interface
107+
posix -DPy_BUILD_CORE posixmodule.c # posix (UNIX) system calls
108+
errno errnomodule.c # posix (UNIX) errno values
109+
pwd pwdmodule.c # this is needed to find out the user's home dir
110+
# if $HOME is not set
111+
_sre _sre.c # Fredrik Lundh's new regular expressions
112+
_codecs _codecsmodule.c # access to the builtin codecs and codec registry
113+
_weakref _weakref.c # weak references
114+
_functools -DPy_BUILD_CORE _functoolsmodule.c # Tools for working with functions and callable objects
115+
_operator _operator.c # operator.add() and similar goodies
116+
_collections _collectionsmodule.c # Container types
117+
_abc _abc.c # Abstract base classes
118+
itertools itertoolsmodule.c # Functions creating iterators for efficient looping
119+
atexit atexitmodule.c # Register functions to be run at interpreter-shutdown
120+
_signal -DPy_BUILD_CORE signalmodule.c
121+
_stat _stat.c # stat.h interface
122+
time -DPy_BUILD_CORE timemodule.c # -lm # time operations and variables
123+
_thread -DPy_BUILD_CORE _threadmodule.c # low-level threading interface
124124

125125
# access to ISO C locale support
126126
_locale _localemodule.c # -lintl
127127

128128
# Standard I/O baseline
129-
_io -I$(srcdir)/Modules/_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c
129+
_io -DPy_BUILD_CORE -I$(srcdir)/Modules/_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c
130130

131131
# The zipimport module is always imported at startup. Having it as a
132132
# builtin module avoids some bootstrapping problems and reduces overhead.
133-
zipimport zipimport.c
133+
zipimport -DPy_BUILD_CORE zipimport.c
134134

135135
# faulthandler module
136136
faulthandler faulthandler.c

Modules/makesetup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
233233
case $doconfig in
234234
no) cc="$cc \$(CCSHARED) \$(PY_CFLAGS) \$(PY_CPPFLAGS)";;
235235
*)
236-
cc="$cc \$(PY_CORE_CFLAGS)";;
236+
cc="$cc \$(PY_STDMODULE_CFLAGS)";;
237237
esac
238238
rule="$obj: $src; $cc $cpps -c $src -o $obj"
239239
echo "$rule" >>$rulesf

0 commit comments

Comments
 (0)