summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-02-26 16:35:03 (GMT)
committerGitHub <noreply@github.com>2022-02-26 16:35:03 (GMT)
commit0d9b565e62a5fc8c3e9b8c64cce764fe084ccb2b (patch)
tree240f3538d78b4f390b97fc1e0a2c1e17102f0d49 /Tools
parentedbee56d698ebb4489aa68311f44d104a23f5eb7 (diff)
downloadcpython-0d9b565e62a5fc8c3e9b8c64cce764fe084ccb2b.zip
cpython-0d9b565e62a5fc8c3e9b8c64cce764fe084ccb2b.tar.gz
cpython-0d9b565e62a5fc8c3e9b8c64cce764fe084ccb2b.tar.bz2
Propagate errors (however unlikely) from _Py_Deepfreeze_Init() (GH-31596)
Diffstat (limited to 'Tools')
-rw-r--r--Tools/scripts/deepfreeze.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Tools/scripts/deepfreeze.py b/Tools/scripts/deepfreeze.py
index 8ea232f..cdd34dd 100644
--- a/Tools/scripts/deepfreeze.py
+++ b/Tools/scripts/deepfreeze.py
@@ -283,7 +283,7 @@ class Printer:
self.write(f".co_cellvars = {co_cellvars},")
self.write(f".co_freevars = {co_freevars},")
self.deallocs.append(f"_PyStaticCode_Dealloc(&{name});")
- self.interns.append(f"_PyStaticCode_InternStrings(&{name});")
+ self.interns.append(f"_PyStaticCode_InternStrings(&{name})")
return f"& {name}.ob_base"
def generate_tuple(self, name: str, t: Tuple[object, ...]) -> str:
@@ -450,9 +450,11 @@ def generate(args: list[str], output: TextIO) -> None:
with printer.block(f"void\n_Py_Deepfreeze_Fini(void)"):
for p in printer.deallocs:
printer.write(p)
- with printer.block(f"void\n_Py_Deepfreeze_Init(void)"):
+ with printer.block(f"int\n_Py_Deepfreeze_Init(void)"):
for p in printer.interns:
- printer.write(p)
+ with printer.block(f"if ({p} < 0)"):
+ printer.write("return -1;")
+ printer.write("return 0;")
if verbose:
print(f"Cache hits: {printer.hits}, misses: {printer.misses}")