8000 bpo-35233: Fix _PyMainInterpreterConfig_Copy() (GH-10537) · python/cpython@88cbea4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 88cbea4

Browse files
authored
bpo-35233: Fix _PyMainInterpreterConfig_Copy() (GH-10537)
Fix _PyMainInterpreterConfig_Copy(): copy 'install_signal_handlers' attribute
1 parent 35c28d5 commit 88cbea4

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

Lib/test/test_embed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase):
267267
)
268268
# FIXME: untested main configuration variables
269269
UNTESTED_MAIN_CONFIG = (
270-
'install_signal_handlers',
271270
'module_search_path',
272271
)
273272
DEFAULT_GLOBAL_CONFIG = {
@@ -363,6 +362,7 @@ def check_config(self, testname, expected, expected_global):
363362
del main_config[key]
364363

365364
expected_main = {
365+
'install_signal_handlers': core_config['install_signal_handlers'],
366366
'argv': [],
367367
'prefix': sys.prefix,
368368
'executable': core_config['executable'],

Modules/main.c

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2652,26 +2652,29 @@ _PyMainInterpreterConfig_Copy(_PyMainInterpreterConfig *config,
26522652
{
26532653
_PyMainInterpreterConfig_Clear(config);
26542654

2655-
#define COPY_ATTR(ATTR) \
2655+
#define COPY_ATTR(ATTR) config->ATTR = config2->ATTR
2656+
#define COPY_OBJ_ATTR(OBJ_ATTR) \
26562657
do { \
2657-
if (config2->ATTR != NULL) { \
2658-
config->ATTR = config_copy_attr(config2->ATTR); \
2659-
if (config->ATTR == NULL) { \
2658+
if (config2->OBJ_ATTR != NULL) { \
2659+
config->OBJ_ATTR = config_copy_attr(config2->OBJ_ATTR); \
2660+
if (config->OBJ_ATTR == NULL) { \
26602661
return -1; \
26612662
} \
26622663
} \
26632664
} while (0)
26642665

2665-
COPY_ATTR(argv);
2666-
COPY_ATTR(executable);
2667-
COPY_ATTR(prefix);
2668-
COPY_ATTR(base_prefix);
2669-
COPY_ATTR(exec_prefix);
2670-
COPY_ATTR(base_exec_prefix);
2671-
COPY_ATTR(warnoptions);
2672-
COPY_ATTR(xoptions);
2673-
COPY_ATTR(module_search_path);
2666+
COPY_ATTR(install_signal_handlers);
2667+
COPY_OBJ_ATTR(argv);
2668+
COPY_OBJ_ATTR(executable);
2669+
COPY_OBJ_ATTR(prefix);
2670+
COPY_OBJ_ATTR(base_prefix);
2671+
COPY_OBJ_ATTR(exec_prefix);
2672+
COPY_OBJ_ATTR(base_exec_prefix);
2673+
COPY_OBJ_ATTR(warnoptions);
2674+
COPY_OBJ_ATTR(xoptions);
2675+
COPY_OBJ_ATTR(module_search_path);
26742676
#undef COPY_ATTR
2677+
#undef COPY_OBJ_ATTR
26752678
return 0;
26762679
}
26772680

0 commit comments

Comments
 (0)
0