]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-102251: Updates to test_imp Toward Fixing Some Refleaks (gh-102254)
authorEric Snow <ericsnowcurrently@gmail.com>
Mon, 27 Feb 2023 16:21:18 +0000 (09:21 -0700)
committerGitHub <noreply@github.com>
Mon, 27 Feb 2023 16:21:18 +0000 (09:21 -0700)
commitbb0cf8fd60e71581a90179af63e60e8704c3814b
treeff79b2597b569b605d5fc4c0681559d8c4c2f333
parent0db6f442598a1994c37f24e704892a2bb71a0a1b
gh-102251: Updates to test_imp Toward Fixing Some Refleaks (gh-102254)

This is related to fixing the refleaks introduced by commit 096d009.  I haven't been able to find the leak yet, but these changes are a consequence of that effort.  This includes some cleanup, some tweaks to the existing tests, and a bunch of new test cases.  The only change here that might have impact outside the tests in question is in imp.py, where I update imp.load_dynamic() to use spec_from_file_location() instead of creating a ModuleSpec directly.

Also note that I've updated the tests to only skip if we're checking for refleaks (regrtest's --huntrleaks), whereas in gh-101969 I had skipped the tests entirely.  The tests will be useful for some upcoming work and I'd rather the refleaks not hold that up.  (It isn't clear how quickly we'll be able to fix the leaking code, though it will certainly be done in the short term.)

https://github.com/python/cpython/issues/102251
Lib/imp.py
Lib/test/test_imp.py
Modules/_testsinglephase.c
Python/import.c