-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-135041: Expand and update pickletools
module docstrings
#135042
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
base: main
Are you sure you want to change the base?
Conversation
Misc/NEWS.d/next/Documentation/2025-06-02-19-49-33.gh-issue-135041.Jt5D8K.rst
Outdated
Show resolved
Hide resolved
pickletools
module docstrings
If not isinstance(callable, type), REDUCE complains unless the | ||
callable has been registered with the copyreg module's | ||
safe_constructors dict, or the callable has a magic | ||
'__safe_for_unpickling__' attribute with a true value. I'm not sure | ||
why it does this, but I've sure seen this complaint often enough when | ||
I didn't want to <wink>. |
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.
Is this no longer accurate?
Add Oxford comma Co-authored-by: Adam Turner <[email protected]>
I believe that should be all the changes you requested, let me know if I've missed anything else. |
@@ -1668,7 +1679,9 @@ def __init__(self, name, code, arg, | |||
Stack before: ... pydict key value | |||
Stack after: ... pydict | |||
|
|||
where pydict has been modified via pydict[key] = value. | |||
where pydict has been modified via pydict[key] = value. Note that any |
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 not we change "dict" to "mapping" in the description? And "list" to "sequence" in the description of APPEND?
The index of the memo object to push is given by the positive | ||
newline-terminated decimal string following. BINGET and LONG_BINGET | ||
are space-optimized versions. |
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.
String can be positive.
Lib/pickletools.py
Outdated
EXT1 has a 1-byte integer argument. This is used to index into | ||
the inverted extension registry, which contains integer to tuple | ||
mappings. The tuples have a length of two in the format of | ||
'("module", "name")'. This tuple is then passed through find_class, | ||
and the result is pushed onto the stack. |
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 mentions too much implementation details (the inverted extension registry and its format). It should only refer to copyreg.add_extension()
(which unfortunately is not documented) and find_class()
(like in GLOBAL
, or just refer to it).
Clarify the `APPENDS` docstring Co-authored-by: Serhiy Storchaka <[email protected]>
A few updates to the
pickletools
description code strings (functioning as documentation for the Pickle Virtual Machine).