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-33042: Fix pre-initialization sys module configuration #6157

Merged
merged 10 commits into from Mar 25, 2018

Conversation

ncoghlan
Copy link
Contributor

@ncoghlan ncoghlan commented Mar 20, 2018

  • new test case for pre-initialization of sys.warnoptions and sys._xoptions
  • restored ability to call these APIs prior to Py_Initialize
  • update the docs for the affected APIs to make it clear they can be
    called before Py_Initialize
  • also enhances the existing embedding test cases
    to check for expected settings in the sys module

https://bugs.python.org/issue33042

- new embedding test case for bpo-33042
- also enhances existing embedding test cases
  to check for expected settings in the sys module
@ncoghlan ncoghlan force-pushed the bpo-33042-restore-preinit-sys-options branch from c415c07 to 1354cef Compare March 20, 2018 12:16
@ncoghlan ncoghlan self-assigned this Mar 20, 2018
- adds checks for a valid thread state
- notes the intended handling of supplied values
- test case no longer segfaults, but fails due to
  the values not being added to the sys module
@ncoghlan
Copy link
Contributor Author

@vstinner @serhiy-storchaka This is lower level C than I've done in quite a while, so it would be nice if one or both of you could take a look at it :)

Serhiy, a bit of extra context here is that the new code all needs to run before _Py_InitializeCore is called, since it's designed to restore the ability for embedding applications to set sys.warnoptions and sys._xoptions programmatically.

@ncoghlan
Copy link
Contributor Author

Also see https://bugs.python.org/issue33042#msg314366 for a potential problem where I suspect the warnings filter list may not yet be getting updated appropriately.

@ncoghlan
Copy link
Contributor Author

@zooba @brettcannon @ericsnowcurrently I'm attempting to fix an app embedding regression that's affecting PyInstaller, but I'm getting a failure that I don't understand for the new test case on Windows. Any chance that one of you might be able to take a look in time for 3.7.0b3?

@ncoghlan ncoghlan changed the title [WIP] bpo-33042: Fix pre-initialization sys module configuration bpo-33042: Fix pre-initialization sys module configuration Mar 25, 2018
@ncoghlan
Copy link
Contributor Author

While I'd have preferred to wait for a review, there's a conflict between that and getting this merged in time for 3.7.0b3, so I'm going to go ahead and merge it. Reviews still welcome, I'll just need to fix any issues found in a follow-up PR.

@ncoghlan ncoghlan merged commit bc77eff into python:master Mar 25, 2018
@miss-islington
Copy link
Contributor

Thanks @ncoghlan for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 25, 2018
…6157)

- new test case for pre-initialization of sys.warnoptions and sys._xoptions
- restored ability to call these APIs prior to Py_Initialize
- updated the docs for the affected APIs to make it clear they can be
  called before Py_Initialize
- also enhanced the existing embedding test cases
  to check for expected settings in the sys module
(cherry picked from commit bc77eff)

Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
@bedevere-bot
Copy link

GH-6232 is a backport of this pull request to the 3.7 branch.

miss-islington added a commit that referenced this pull request Mar 25, 2018
- new test case for pre-initialization of sys.warnoptions and sys._xoptions
- restored ability to call these APIs prior to Py_Initialize
- updated the docs for the affected APIs to make it clear they can be
  called before Py_Initialize
- also enhanced the existing embedding test cases
  to check for expected settings in the sys module
(cherry picked from commit bc77eff)

Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
@ncoghlan ncoghlan deleted the bpo-33042-restore-preinit-sys-options branch March 30, 2018 07:43
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.

None yet

4 participants