/* Deallocator function for static codeobjects used in deepfreeze.py */
void _PyStaticCode_Dealloc(PyCodeObject *co);
+/* Function to intern strings of codeobjects */
+void _PyStaticCode_InternStrings(PyCodeObject *co);
#ifdef Py_STATS
--- /dev/null
+Intern strings in deep-frozen modules. Patch by Kumar Aditya.
\ No newline at end of file
co->co_weakreflist = NULL;
}
}
+
+void
+_PyStaticCode_InternStrings(PyCodeObject *co)
+{
+ int res = intern_strings(co->co_names);
+ assert(res == 0);
+ res = intern_string_constants(co->co_consts, NULL);
+ assert(res == 0);
+ res = intern_strings(co->co_localsplusnames);
+ assert(res == 0);
+ (void)res;
+}
self.write(f".co_cellvars = {co_cellvars},")
self.write(f".co_freevars = {co_freevars},")
self.deallocs.append(f"_PyStaticCode_Dealloc(&{name});")
+ self.patchups.append(f"_PyStaticCode_InternStrings(&{name});")
return f"& {name}.ob_base"
def generate_tuple(self, name: str, t: Tuple[object, ...]) -> str: