-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-1635741: Port audioop extension module to multiphase initialization(PEP 489) #18608
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
Codecov Report
@@ Coverage Diff @@
## master #18608 +/- ##
==========================================
+ Coverage 82.11% 82.13% +0.01%
==========================================
Files 1956 1955 -1
Lines 589425 584605 -4820
Branches 44458 44484 +26
==========================================
- Hits 484018 480164 -3854
+ Misses 95752 94793 -959
+ Partials 9655 9648 -7
Continue to review full report at Codecov.
|
Looks there have an potential bug, because running test_audioop test case, the error name not belong to audioop: |
I don't have a Windows machine to test this on. Could you first turn the macro into an inline function, and rename the type (to something like |
of course, let me try it now ;) |
petr, it's failed again, so I try to find a win env to debug~ |
audioop_traverse(PyObject *m, visitproc visit, void *arg) | ||
{ | ||
audioop_state *state = (audioop_state *)PyModule_GetState(m); | ||
if (state) { |
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.
Is it really possible that state can be NULL when this function is called?
audioop_clear(PyObject *m) | ||
{ | ||
audioop_state *state = (audioop_state *)PyModule_GetState(m); | ||
if (state) { |
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.
Is it really possible that state can be NULL when this function is called?
module_clear() doesn't touch module->md_state value. Only module_dealloc() calls PyMem_FREE(m->md_state). But audioop_clear() must not be called on a deallocated module object.
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.
I would prefer to see this question answered before approving the PR.
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.
See the docs.
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.
Is it worth us to change this logic as victor said?
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.
I created https://bugs.python.org/issue39824 to propose to change the Python behavior, so modules would not have to handle md_state=NULL anymore.
Co-Authored-By: Victor Stinner <[email protected]>
Oh, gate have passed, thanks, victor. |
https://bugs.python.org/issue1635741