Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use global singletons for single byte bytes objects in deepfreeze.
2 changes: 2 additions & 0 deletions Tools/scripts/deepfreeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ def field(self, obj: object, name: str) -> None:
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"):
Expand Down