From e1efa22b92747e6bef4d3345eb36a0e778e568b6 Mon Sep 17 00:00:00 2001 From: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Date: Fri, 28 Jan 2022 17:09:05 +0530 Subject: [PATCH 1/3] use strong ref --- Tools/scripts/deepfreeze.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/scripts/deepfreeze.py b/Tools/scripts/deepfreeze.py index db44ba89c671e23..080980f6d0ae5d9 100644 --- a/Tools/scripts/deepfreeze.py +++ b/Tools/scripts/deepfreeze.py @@ -406,7 +406,7 @@ def generate(self, name: str, obj: object) -> str: _Py_get_%%NAME%%_toplevel(void) { %%NAME%%_do_patchups(); - return (PyObject *) &%%NAME%%_toplevel; + return Py_NewRef((PyObject *) &%%NAME%%_toplevel); } """ From 3d175a7c6f6db2c88703ac9fd107f38fc73d38c0 Mon Sep 17 00:00:00 2001 From: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Date: Fri, 28 Jan 2022 17:22:15 +0530 Subject: [PATCH 2/3] add comment --- Include/cpython/import.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Include/cpython/import.h b/Include/cpython/import.h index 5ec637e7ab3b8cb..a2597711f951078 100644 --- a/Include/cpython/import.h +++ b/Include/cpython/import.h @@ -32,7 +32,7 @@ struct _frozen { const char *name; /* ASCII encoded string */ const unsigned char *code; int size; - PyObject *(*get_code)(void); + PyObject *(*get_code)(void); /* Returns strong ref */ }; /* Embedding apps may change this pointer to point to their favorite From 7b9ee43fb490e93ede3b0a64d7324b46160256a6 Mon Sep 17 00:00:00 2001 From: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Date: Fri, 28 Jan 2022 12:21:54 +0000 Subject: [PATCH 3/3] remove comment --- Include/cpython/import.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Include/cpython/import.h b/Include/cpython/import.h index a2597711f951078..5ec637e7ab3b8cb 100644 --- a/Include/cpython/import.h +++ b/Include/cpython/import.h @@ -32,7 +32,7 @@ struct _frozen { const char *name; /* ASCII encoded string */ const unsigned char *code; int size; - PyObject *(*get_code)(void); /* Returns strong ref */ + PyObject *(*get_code)(void); }; /* Embedding apps may change this pointer to point to their favorite