bpo-33042: Fix pre-initialization sys module configuration by ncoghlan · Pull Request #6157 · python/cpython (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation6 Commits10 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
- 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
- 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
@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.
@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 changed the title
[WIP] bpo-33042: Fix pre-initialization sys module configuration bpo-33042: Fix pre-initialization sys module configuration
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.
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
- 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
miss-islington added a commit that referenced this pull request
- 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 deleted the bpo-33042-restore-preinit-sys-options branch