From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sun, 24 Dec 2023 10:01:08 +0000 (+0100) Subject: [3.12] gh-113028: Correctly memoize str in pickle when escapes added (GH-113436)... X-Git-Tag: v3.12.2~268 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=269cb342ad487c7c244659bd25ed6d4d7bb95876;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-113028: Correctly memoize str in pickle when escapes added (GH-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 08398631a0298dcf785ee7bd0e26c7844823ce59) Co-authored-by: Jeff Allen --- diff --git a/Lib/pickle.py b/Lib/pickle.py index fe86f80f51d3..f54a607cf298 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -855,13 +855,13 @@ class _Pickler: else: self.write(BINUNICODE + pack("