bpo-1635741: Port audioop extension module to multiphase initialization(PEP 489)#18608
bpo-1635741: Port audioop extension module to multiphase initialization(PEP 489)#18608vstinner merged 7 commits intopython:masterfrom
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.
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.
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.
I would prefer to see this question answered before approving the PR.
There was a problem hiding this comment.
Is it worth us to change this logic as victor said?
There was a problem hiding this comment.
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 <vstinner@python.org>
|
Oh, gate have passed, thanks, victor. |
https://bugs.python.org/issue1635741