-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-44353: Fix memory leak introduced by #27262 #27305
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3692,10 +3692,15 @@ def test_c_functions(self): | |
|
||
|
||
class NewTypeTests: | ||
def cleanup(self): | ||
for f in self.module._cleanups: | ||
f() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those seem to be cleaning LRU caches for various type There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, and it clears |
||
|
||
def setUp(self): | ||
sys.modules['typing'] = self.module | ||
|
||
def tearDown(self): | ||
self.cleanup() | ||
sys.modules['typing'] = typing | ||
|
||
def test_basic(self): | ||
|
@@ -3738,12 +3743,12 @@ def test_repr(self): | |
|
||
self.assertEqual(repr(UserId), f'{__name__}.UserId') | ||
|
||
class NewTypePythonTests(BaseTestCase, NewTypeTests): | ||
class NewTypePythonTests(NewTypeTests, BaseTestCase): | ||
module = py_typing | ||
|
||
|
||
@skipUnless(c_typing, 'requires _typing') | ||
class NewTypeCTests(BaseTestCase, NewTypeTests): | ||
class NewTypeCTests(NewTypeTests, BaseTestCase): | ||
module = c_typing | ||
|
||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Note to self: this is different from BaseTestCase.clear_caches because here we use
self.module
instead of hard-codedtyping
.Uh oh!
There was an error while loading. Please reload this page.
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.
Wow, great investigating @uriyyo! I forgot that the global
typing
and thepy_typing
used forNewType
tests are different module objects. I was quite puzzled for a while about why theBaseTestCase
clearing didn't work :).Uh oh!
There was an error while loading. Please reload this page.
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.
@Fidget-Spinner I spent a lot of time investigating C code because though that problem was at it, but actual problem was at test code)
It was tricky but interesting to investigate this memory leak)