diff options
author | Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> | 2022-01-23 17:45:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-23 17:45:39 (GMT) |
commit | ca78130d7eb5265759697639e42487ec6d0a4caf (patch) | |
tree | 72f7313bc352fef9dfc439f1da5d65b0d98d6d66 /Tools | |
parent | 691506f4e9408a1205166f99640946ad7822e302 (diff) | |
download | cpython-ca78130d7eb5265759697639e42487ec6d0a4caf.zip cpython-ca78130d7eb5265759697639e42487ec6d0a4caf.tar.gz cpython-ca78130d7eb5265759697639e42487ec6d0a4caf.tar.bz2 |
bpo-46471: Use single byte singletons (GH-30781)
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/scripts/deepfreeze.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Tools/scripts/deepfreeze.py b/Tools/scripts/deepfreeze.py index a7546a8..a1ef85e 100644 --- a/Tools/scripts/deepfreeze.py +++ b/Tools/scripts/deepfreeze.py @@ -150,6 +150,8 @@ class Printer: def generate_bytes(self, name: str, b: bytes) -> str: if b == b"": return "(PyObject *)&_Py_SINGLETON(bytes_empty)" + if len(b) == 1: + return f"(PyObject *)&_Py_SINGLETON(bytes_characters[{b[0]}])" self.write("static") with self.indent(): with self.block("struct"): |