Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Modules/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,7 @@ pymain_read_conf(_PyMain *pymain, _PyCoreConfig *config,
void
_PyMainInterpreterConfig_Clear(_PyMainInterpreterConfig *config)
{
config->install_signal_handlers = -1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that it's needed, this function is only used to release memory, not to reset a config to the default config.

If you really need to reset to the default config, I would prefer to use _PyMainInterpreterConfig_INIT to reduce maintenance (avoid duplication of code).

Py_CLEAR(config->argv);
Py_CLEAR(config->executable);
Py_CLEAR(config->prefix);
Expand Down Expand Up @@ -1441,6 +1442,8 @@ _PyMainInterpreterConfig_Copy(_PyMainInterpreterConfig *config,
{
_PyMainInterpreterConfig_Clear(config);

config->install_signal_handlers = config2->install_signal_handlers;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to use a COPY_ATTR() macro here:

#define COPY_ATTR(ATTR) config->ATTR = config2->ATTR

Rename the existing macro to COPY_OBJ_ATTR(): see _PyCoreConfig_Copy().


#define COPY_ATTR(ATTR) \
do { \
if (config2->ATTR != NULL) { \
Expand Down