Skip to content

Commit 0e1c2f3

Browse files
authored
bpo-45847: port _struct to PY_STDLIB_MOD (GH-29706)
1 parent 4fad314 commit 0e1c2f3

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

Modules/Setup.stdlib.in

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
@MODULE__PICKLE_TRUE@_pickle _pickle.c
4141
@MODULE__QUEUE_TRUE@_queue _queuemodule.c
4242
@MODULE__RANDOM_TRUE@_random _randommodule.c
43+
@MODULE__STRUCT_TRUE@_struct _struct.c
4344
@MODULE__TYPING_TRUE@_typing _typingmodule.c
4445
@MODULE__XXSUBINTERPRETERS_TRUE@_xxsubinterpreters _xxsubinterpretersmodule.c
4546
@MODULE__ZONEINFO_TRUE@_zoneinfo _zoneinfo.c

configure

+15
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,8 @@ MODULE__XXSUBINTERPRETERS_FALSE
718718
MODULE__XXSUBINTERPRETERS_TRUE
719719
MODULE__TYPING_FALSE
720720
MODULE__TYPING_TRUE
721+
MODULE__STRUCT_FALSE
722+
MODULE__STRUCT_TRUE
721723
MODULE_SELECT_FALSE
722724
MODULE_SELECT_TRUE
723725
MODULE__RANDOM_FALSE
@@ -20571,6 +20573,15 @@ else
2057120573
fi
2057220574
as_fn_append MODULE_BLOCK "MODULE_SELECT=yes$as_nl"
2057320575

20576+
if true; then
20577+
MODULE__STRUCT_TRUE=
20578+
MODULE__STRUCT_FALSE='#'
20579+
else
20580+
MODULE__STRUCT_TRUE='#'
20581+
MODULE__STRUCT_FALSE=
20582+
fi
20583+
as_fn_append MODULE_BLOCK "MODULE__STRUCT=yes$as_nl"
20584+
2057420585
if true; then
2057520586
MODULE__TYPING_TRUE=
2057620587
MODULE__TYPING_FALSE='#'
@@ -22011,6 +22022,10 @@ if test -z "${MODULE_SELECT_TRUE}" && test -z "${MODULE_SELECT_FALSE}"; then
2201122022
as_fn_error $? "conditional \"MODULE_SELECT\" was never defined.
2201222023
Usually this means the macro was only invoked conditionally." "$LINENO" 5
2201322024
fi
22025+
if test -z "${MODULE__STRUCT_TRUE}" && test -z "${MODULE__STRUCT_FALSE}"; then
22026+
as_fn_error $? "conditional \"MODULE__STRUCT\" was never defined.
22027+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
22028+
fi
2201422029
if test -z "${MODULE__TYPING_TRUE}" && test -z "${MODULE__TYPING_FALSE}"; then
2201522030
as_fn_error $? "conditional \"MODULE__TYPING\" was never defined.
2201622031
Usually this means the macro was only invoked conditionally." "$LINENO" 5

configure.ac

+1
Original file line numberDiff line numberDiff line change
@@ -6137,6 +6137,7 @@ PY_STDLIB_MOD_SIMPLE([_posixsubprocess])
61376137
PY_STDLIB_MOD_SIMPLE([_queue])
61386138
PY_STDLIB_MOD_SIMPLE([_random])
61396139
PY_STDLIB_MOD_SIMPLE([select])
6140+
PY_STDLIB_MOD_SIMPLE([_struct])
61406141
PY_STDLIB_MOD_SIMPLE([_typing])
61416142
PY_STDLIB_MOD_SIMPLE([_xxsubinterpreters])
61426143
PY_STDLIB_MOD_SIMPLE([_zoneinfo])

setup.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,7 @@ def detect_simple_extensions(self):
10231023

10241024
self.addext(Extension("_queue", ["_queuemodule.c"]))
10251025
self.addext(Extension("_statistics", ["_statisticsmodule.c"]))
1026+
self.addext(Extension("_struct", ["_struct.c"]))
10261027
self.addext(Extension("_typing", ["_typingmodule.c"]))
10271028

10281029
# Modules with some UNIX dependencies -- on by default:
@@ -1446,6 +1447,9 @@ def detect_uuid(self):
14461447
self.missing.append('_uuid')
14471448

14481449
def detect_modules(self):
1450+
# remove dummy extension
1451+
self.extensions = []
1452+
14491453
self.configure_compiler()
14501454
self.init_inc_lib_dirs()
14511455

@@ -2100,9 +2104,9 @@ class DummyProcess:
21002104
'build_scripts': PyBuildScripts,
21012105
'install': PyBuildInstall,
21022106
'install_lib': PyBuildInstallLib},
2103-
# The struct module is defined here, because build_ext won't be
2107+
# A dummy module is defined here, because build_ext won't be
21042108
# called unless there's at least one extension module defined.
2105-
ext_modules=[Extension('_struct', ['_struct.c'])],
2109+
ext_modules=[Extension('_dummy', ['_dummy.c'])],
21062110

21072111
# If you change the scripts installed here, you also need to
21082112
# check the PyBuildScripts command above, and change the links

0 commit comments

Comments
 (0)