Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bpo-39435: Fix docs for pickle.loads #18160

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 3 commits into from
May 1, 2020

Conversation

hauntsaninja
Copy link
Contributor

@hauntsaninja hauntsaninja commented Jan 24, 2020

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

Recognized GitHub username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@hauntsaninja

This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@hauntsaninja
Copy link
Contributor Author

Hello, it's my first time contributing to CPython!

Apologies if something is incorrect. make patchcheck complained about not having updating Misc/ACKS, although this is a trivial change, so sort of confused about that. Hopefully it'll recognise my CLA signature soon :-)

@tirkarthi tirkarthi requested a review from pitrou January 24, 2020 19:26
@pitrou
Copy link
Member

pitrou commented Jan 24, 2020

Thanks for contributing this. However, I don't think there is anything to fix. The argument is positional only (hence the / after it), so its name is purely indicative. Here, bytes_object points to the kind of object that is accepted. By renaming it to data, that information is removed.

@pitrou
Copy link
Member

pitrou commented Jan 24, 2020

I'm rejecting this PR.

@pitrou pitrou closed this Jan 24, 2020
@hauntsaninja
Copy link
Contributor Author

hauntsaninja commented Jan 25, 2020

Hello @pitrou , thanks for reviewing!
I don't see a / for positional-only, all I see is a * for the remaining arguments being keyword-only. Note that the asterisk is escaped with a backslash in the .rst which could be a possible source of confusion?
As far as I can tell, the argument is not positional-only in pickle.rst on master (.. function:: loads(bytes_object, \*, fix_imports=True, encoding="ASCII", errors="strict", buffers=None)), the rendered documentation at https://docs.python.org/3/library/pickle.html#pickle.loads or the behaviour at runtime:

>>> sys.version
'3.7.6 (default, Dec 30 2019, 19:38:26) \n[Clang 11.0.0 (clang-1100.0.33.16)]'
>>> inspect.signature(pickle.loads)
<Signature (data, *, fix_imports=True, encoding='ASCII', errors='strict')>

If you feel bytes_object is a better name than data, maybe we could actually document the argument as positional-only, and leave the fact that it is positional-or-keyword as undocumented, (or change the implementation to use the name bytes_object).

@pitrou
Copy link
Member

pitrou commented Jan 25, 2020

Hi @hauntsaninja, you're right, it seems I confused the \ with a /. Sorry for that, and I'm reopening the PR.

@hauntsaninja
Copy link
Contributor Author

Gentle bump :-)

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Thank you. Just one comment.


Return the reconstituted object hierarchy of the pickled representation
*bytes_object* of an object.
*data* of an object.
Copy link
Member

Choose a reason for hiding this comment

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

Ok, but then you should mention that data has to be a bytes-like object.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@hauntsaninja
Copy link
Contributor Author

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@pitrou: please review the changes made to this pull request.

@bedevere-bot bedevere-bot requested a review from pitrou May 1, 2020 17:41
@miss-islington
Copy link
Contributor

Thanks @hauntsaninja for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7, 3.8.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry @hauntsaninja, I had trouble checking out the 3.8 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 289842ae820f99908d3a345f1f3b6d4e5b4b97fc 3.8

@pitrou
Copy link
Member

pitrou commented May 1, 2020

Thank you @hauntsaninja !

@miss-islington miss-islington self-assigned this May 1, 2020
@miss-islington
Copy link
Contributor

Sorry, @hauntsaninja, I could not cleanly backport this to 3.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 289842ae820f99908d3a345f1f3b6d4e5b4b97fc 3.7

@hauntsaninja hauntsaninja deleted the bpo39435 branch May 1, 2020 19:47
@bedevere-bot
Copy link

GH-19843 is a backport of this pull request to the 3.8 branch.

@bedevere-bot
Copy link

GH-19844 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit that referenced this pull request May 1, 2020
(cherry picked from commit 289842a)

Co-authored-by: Shantanu <[email protected]>

Automerge-Triggered-By: @pitrou
miss-islington pushed a commit that referenced this pull request May 1, 2020
(cherry picked from commit 289842a)

Co-authored-by: Shantanu <[email protected]>

Automerge-Triggered-By: @pitrou
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants