mirror of
https://github.com/python/cpython.git
synced 2025-11-03 11:23:31 +00:00
bpo-46471: Use single byte singletons (GH-30781)
This commit is contained in:
parent
691506f4e9
commit
ca78130d7e
2 changed files with 3 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
Use global singletons for single byte bytes objects in deepfreeze.
|
||||
|
|
@ -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"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue