-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-128615: Cover pickling of ParamSpecArgs
and ParamSpecKwargs
#128616
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
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.
Thanks!
@@ -5182,6 +5182,18 @@ class C(B[int]): | |||
x = pickle.loads(z) | |||
self.assertEqual(s, x) | |||
|
|||
# Test ParamSpec args and kwargs | |||
global PP |
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.
could this be combined into the global
statement at the top of the function? (global C, PP
)
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.
It feel more readable to have this name defined as global
near the place where this is needed.
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.
Fair enough, I don't feel strongly :)
pickle.loads(pickle.dumps(thing, proto)), | ||
thing, | ||
) | ||
del PP |
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.
should this be some sort of context manager so that PP
is del
'd from the global namespace even if an exception in the for
loop leads to the test terminating early?
should we also del
the C
name, which is declared as global
on the first line of this function?
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.
There are multiple places where this pattern is used. I think that it should be fine, because the only problem that I can think of is that PP
will be reported as changed by refleak
. So, not a big deal in case of a failure.
But, this can be refactored in the future, if desired.
Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
…gs` (pythonGH-128616) (cherry picked from commit 74a5171) Co-authored-by: sobolevn <[email protected]>
GH-128625 is a backport of this pull request to the 3.13 branch. |
…gs` (pythonGH-128616) (cherry picked from commit 74a5171) Co-authored-by: sobolevn <[email protected]>
GH-128626 is a backport of this pull request to the 3.12 branch. |
…rgs` (GH-128616) (#128626) Co-authored-by: sobolevn <[email protected]>
Refs 24d8b88
ParamSpecArgs
andParamSpecKwargs
is not covered #128615