-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-113028: correctly memoize str when escapes added #113436
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
This fixes a divergence between the Python and C implementations of pickle for protocol 0, such that it pickle.py fails to re-use the first pickled representation of strings involving characters that have to be escaped.
Making this draft while I blurb it. |
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.
LGTM.
Thanks @jeff5 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
GH-113448 is a backport of this pull request to the 3.12 branch. |
…ythonGH-113436) This fixes a divergence between the Python and C implementations of pickle for protocol 0, such that it pickle.py fails to re-use the first pickled representation of strings involving characters that have to be escaped. (cherry picked from commit 0839863) Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
…ythonGH-113436) This fixes a divergence between the Python and C implementations of pickle for protocol 0, such that it pickle.py fails to re-use the first pickled representation of strings involving characters that have to be escaped. (cherry picked from commit 0839863) Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
GH-113449 is a backport of this pull request to the 3.11 branch. |
…H-113436) (GH-113448) This fixes a divergence between the Python and C implementations of pickle for protocol 0, such that it pickle.py fails to re-use the first pickled representation of strings involving characters that have to be escaped. (cherry picked from commit 0839863) Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
…H-113436) (GH-113449) This fixes a divergence between the Python and C implementations of pickle for protocol 0, such that it pickle.py fails to re-use the first pickled representation of strings involving characters that have to be escaped. (cherry picked from commit 0839863) Co-authored-by: Jeff Allen <ja.py@farowl.co.uk>
…ythonGH-113436) This fixes a divergence between the Python and C implementations of pickle for protocol 0, such that it pickle.py fails to re-use the first pickled representation of strings involving characters that have to be escaped.
…ythonGH-113436) This fixes a divergence between the Python and C implementations of pickle for protocol 0, such that it pickle.py fails to re-use the first pickled representation of strings involving characters that have to be escaped.
…ythonGH-113436) This fixes a divergence between the Python and C implementations of pickle for protocol 0, such that it pickle.py fails to re-use the first pickled representation of strings involving characters that have to be escaped.
…ythonGH-113436) This fixes a divergence between the Python and C implementations of pickle for protocol 0, such that it pickle.py fails to re-use the first pickled representation of strings involving characters that have to be escaped.
Ensure that when pickling a str using the Python implementation in pickle.py, the original object is made the memo key (as in the C version), rather than the replacement, which when escape sequences are added. The result is that a second reference to a string in the input will un-pickle as a repeat reference, rather than as a duplicate object. The change also adds a test for this.
Fixes #113028 .