diff options
author | Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> | 2022-04-19 17:41:36 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-19 17:41:36 (GMT) |
commit | ab0d35d70dfe0b4c11583f8f735a8cc49b58c58b (patch) | |
tree | ed1f726c61787498c0d7fa9890c932d6945ee881 /Tools/scripts/deepfreeze.py | |
parent | 3c4380651301f255ef8149b638a1fae205ede575 (diff) | |
download | cpython-ab0d35d70dfe0b4c11583f8f735a8cc49b58c58b.zip cpython-ab0d35d70dfe0b4c11583f8f735a8cc49b58c58b.tar.gz cpython-ab0d35d70dfe0b4c11583f8f735a8cc49b58c58b.tar.bz2 |
bpo-46712: share more global strings in deepfreeze (gh-32152)
(for gh-90868)
Diffstat (limited to 'Tools/scripts/deepfreeze.py')
-rw-r--r-- | Tools/scripts/deepfreeze.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Tools/scripts/deepfreeze.py b/Tools/scripts/deepfreeze.py index dfa4b3a..3c48bac 100644 --- a/Tools/scripts/deepfreeze.py +++ b/Tools/scripts/deepfreeze.py @@ -18,7 +18,7 @@ import umarshal from generate_global_objects import get_identifiers_and_strings verbose = False -identifiers = get_identifiers_and_strings()[0] +identifiers, strings = get_identifiers_and_strings() def isprintable(b: bytes) -> bool: return all(0x20 <= c < 0x7f for c in b) @@ -168,6 +168,8 @@ class Printer: return f"& {name}.ob_base.ob_base" def generate_unicode(self, name: str, s: str) -> str: + if s in strings: + return f"&_Py_STR({strings[s]})" if s in identifiers: return f"&_Py_ID({s})" if re.match(r'\A[A-Za-z0-9_]+\Z', s): |