Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-30598: _PySys_EndInit() now duplicates warnoptions #1998

Merged
merged 1 commit into from
Jun 8, 2017
Merged

bpo-30598: _PySys_EndInit() now duplicates warnoptions #1998

merged 1 commit into from
Jun 8, 2017

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jun 8, 2017

Fix a reference in subinterpreters, like test_callbacks_leak() of
test_atexit.

warnoptions is a list used to pass options from the command line to
the sys module constructor. Before this change, the list was shared
by multiple interpreter which is not the expected behaviour. Each
interpreter should have their own independent mutable world.

This change duplicates the list in each interpreter. So each
interpreter owns its own list, so each interpreter can clear its own
list.

Fix a reference in subinterpreters, like test_callbacks_leak() of
test_atexit.

warnoptions is a list used to pass options from the command line to
the sys module constructor. Before this change, the list was shared
by multiple interpreter which is not the expected behaviour. Each
interpreter should have their own independent mutable world.

This change duplicates the list in each interpreter. So each
interpreter owns its own list, so each interpreter can clear its own
list.
Copy link
Contributor

@ncoghlan ncoghlan left a comment

Choose a reason for hiding this comment

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

This makes sense to me - PEP 432 has the config setting eventually moving into the main interpreter config struct, and then each interpreter instance should have its own copy drawn from that original.

@vstinner
Copy link
Member Author

vstinner commented Jun 8, 2017

This makes sense to me - PEP 432 has the config setting eventually moving into the main interpreter config struct, and then each interpreter instance should have its own copy drawn from that original.

For me, the current global variable is only here to pass the initial value. Once sys is created, I don't expect that the global variable and sys.warnoptions are linked anymore. If you modify the global variable after sys creation, it should do nothing. Well, in practice, it will affect the newly created subinterpreters.

And now replace "global variable" with "config" ;-)

@vstinner vstinner merged commit 865de27 into python:master Jun 8, 2017
@vstinner vstinner deleted the warnoptions branch June 8, 2017 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants