-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-39796: Fix _warnings module initialization #18739
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
Conversation
* Add _PyWarnings_InitState() which only initializes the _warnings module state (tstate->interp->warnings) without creating a module object * Py_InitializeFromConfig() now calls _PyWarnings_InitState() instead of _PyWarnings_Init() * Rename also private functions of _warnings.c to avoid confusion between the public C API and the private C API.
@shihai1991: this change should help to prepare _warnings.c for adopting the PEP 489 ;-) |
Codecov Report
@@ Coverage Diff @@
## master #18739 +/- ##
==========================================
- Coverage 82.14% 82.13% -0.01%
==========================================
Files 1956 1955 -1
Lines 590140 584778 -5362
Branches 44488 44489 +1
==========================================
- Hits 484743 480324 -4419
+ Misses 95745 94803 -942
+ Partials 9652 9651 -1
Continue to review full report at Codecov.
|
Wow, victor. Rapid response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I forgot submit a comment~
_PyWarnings_InitState(PyThreadState *tstate) | ||
{ | ||
if (warnings_init_state(&tstate->interp->warnings) < 0) { | ||
return _PyStatus_ERR("can't initialize warnings"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about can't initialize warnings state
?
Oh, I already merged my PR. Well, I don't think that it's worth it to change the error message. It should never occur in practice :-) |
module state (tstate->interp->warnings) without creating a module
object
of _PyWarnings_Init()
between the public C API and the private C API.
https://bugs.python.org/issue39796