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
Reloading an extension module always leaks #47917
Comments
With python2.6, reloading extension modules does not always leak memory: Python 2.6b2+ (trunk, Aug 19 2008, 23:45:24) [MSC v.1500 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
[34467 refs]
>>> import audioop; del sys.modules['audioop']
[34677 refs]
>>> import audioop; del sys.modules['audioop']
[34677 refs] But with 3.0, reloading audioop leaks 60 references every time (seen in Python 3.0b3+ (py3k, Aug 24 2008, 21:56:40) [MSC v.1500 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
[42018 refs]
>>> import audioop; del sys.modules['audioop']
[42257 refs]
>>> import audioop; del sys.modules['audioop']
[42317 refs]
>>> import audioop; del sys.modules['audioop']
[42377 refs]
>>> import audioop; del sys.modules['audioop']
[42437 refs]
>>> import audioop; del sys.modules['audioop']
[42497 refs] OK, many things cannot be reinitialized for C-written modules (static |
The fix is actually simple: _PyImport_FindExtension() used to return a See attached patch. (for unit tests, run for example |
The patch looks good. Benjamin will commit this. |
Fixed in r66204. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: