Skip to content

Conversation

@Legoclones
Copy link
Contributor

@Legoclones Legoclones commented Jun 2, 2025

A few updates to the pickletools description code strings (functioning as documentation for the Pickle Virtual Machine).

@AA-Turner AA-Turner changed the title gh-135041: Pickle documentation update gh-135041: Expand and update pickletools module docstrings Jun 2, 2025
Comment on lines -1976 to -1981
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>.
Copy link
Member

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?

@AA-Turner AA-Turner added docs Documentation in the Doc dir skip news labels Jun 2, 2025
@github-project-automation github-project-automation bot moved this to Todo in Docs PRs Jun 2, 2025
@python-cla-bot
Copy link

python-cla-bot bot commented Jun 3, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

Add Oxford comma

Co-authored-by: Adam Turner <[email protected]>
@Legoclones
Copy link
Contributor Author

I believe that should be all the changes you requested, let me know if I've missed anything else.

Stack after: ... pydict
where pydict has been modified via pydict[key] = value.
where pydict has been modified via pydict[key] = value. Note that any
Copy link
Member

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?

Comment on lines +1819 to +1821
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String can be positive.

Comment on lines 1918 to 1922
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.
Copy link
Member

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).

@serhiy-storchaka serhiy-storchaka requested a review from pitrou June 17, 2025 10:33
Legoclones and others added 2 commits June 17, 2025 09:41
Clarify the `APPENDS` docstring

Co-authored-by: Serhiy Storchaka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants