Skip to content

Commit ca2fe14

Browse files
committed
bpo-45847: port _struct to PY_STDLIB_MOD
Signed-off-by: Christian Heimes <christian@python.org>
1 parent c6dec7e commit ca2fe14

File tree

4 files changed

+23
-2
lines changed

4 files changed

+23
-2
lines changed

Modules/Setup.stdlib.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
@MODULE__PICKLE_TRUE@_pickle _pickle.c
4040
@MODULE__QUEUE_TRUE@_queue _queuemodule.c
4141
@MODULE__RANDOM_TRUE@_random _randommodule.c
42+
@MODULE__STRUCT_TRUE@_struct _struct.c
4243
@MODULE__TYPING_TRUE@_typing _typingmodule.c
4344
@MODULE__XXSUBINTERPRETERS_TRUE@_xxsubinterpreters _xxsubinterpretersmodule.c
4445
@MODULE__ZONEINFO_TRUE@_zoneinfo _zoneinfo.c

configure

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,8 @@ MODULE__XXSUBINTERPRETERS_FALSE
716716
MODULE__XXSUBINTERPRETERS_TRUE
717717
MODULE__TYPING_FALSE
718718
MODULE__TYPING_TRUE
719+
MODULE__STRUCT_FALSE
720+
MODULE__STRUCT_TRUE
719721
MODULE_SELECT_FALSE
720722
MODULE_SELECT_TRUE
721723
MODULE__RANDOM_FALSE
@@ -20547,6 +20549,15 @@ else
2054720549
fi
2054820550
as_fn_append MODULE_BLOCK "MODULE_SELECT=yes$as_nl"
2054920551

20552+
if true; then
20553+
MODULE__STRUCT_TRUE=
20554+
MODULE__STRUCT_FALSE='#'
20555+
else
20556+
MODULE__STRUCT_TRUE='#'
20557+
MODULE__STRUCT_FALSE=
20558+
fi
20559+
as_fn_append MODULE_BLOCK "MODULE__STRUCT=yes$as_nl"
20560+
2055020561
if true; then
2055120562
MODULE__TYPING_TRUE=
2055220563
MODULE__TYPING_FALSE='#'
@@ -21968,6 +21979,10 @@ if test -z "${MODULE_SELECT_TRUE}" && test -z "${MODULE_SELECT_FALSE}"; then
2196821979
as_fn_error $? "conditional \"MODULE_SELECT\" was never defined.
2196921980
Usually this means the macro was only invoked conditionally." "$LINENO" 5
2197021981
fi
21982+
if test -z "${MODULE__STRUCT_TRUE}" && test -z "${MODULE__STRUCT_FALSE}"; then
21983+
as_fn_error $? "conditional \"MODULE__STRUCT\" was never defined.
21984+
Usually this means the macro was only invoked conditionally." "$LINENO" 5
21985+
fi
2197121986
if test -z "${MODULE__TYPING_TRUE}" && test -z "${MODULE__TYPING_FALSE}"; then
2197221987
as_fn_error $? "conditional \"MODULE__TYPING\" was never defined.
2197321988
Usually this means the macro was only invoked conditionally." "$LINENO" 5

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6135,6 +6135,7 @@ PY_STDLIB_MOD_SIMPLE([_pickle])
61356135
PY_STDLIB_MOD_SIMPLE([_queue])
61366136
PY_STDLIB_MOD_SIMPLE([_random])
61376137
PY_STDLIB_MOD_SIMPLE([select])
6138+
PY_STDLIB_MOD_SIMPLE([_struct])
61386139
PY_STDLIB_MOD_SIMPLE([_typing])
61396140
PY_STDLIB_MOD_SIMPLE([_xxsubinterpreters])
61406141
PY_STDLIB_MOD_SIMPLE([_zoneinfo])

setup.py

Lines changed: 6 additions & 2 deletions
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:
@@ -1447,6 +1448,9 @@ def detect_uuid(self):
14471448
self.missing.append('_uuid')
14481449

14491450
def detect_modules(self):
1451+
# remove dummy extension
1452+
self.extensions = []
1453+
14501454
self.configure_compiler()
14511455
self.init_inc_lib_dirs()
14521456

@@ -2101,9 +2105,9 @@ class DummyProcess:
21012105
'build_scripts': PyBuildScripts,
21022106
'install': PyBuildInstall,
21032107
'install_lib': PyBuildInstallLib},
2104-
# The struct module is defined here, because build_ext won't be
2108+
# A dummy module is defined here, because build_ext won't be
21052109
# called unless there's at least one extension module defined.
2106-
ext_modules=[Extension('_struct', ['_struct.c'])],
2110+
ext_modules=[Extension('_dummy', ['_dummy.c'])],
21072111

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

0 commit comments

Comments
 (0)