]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-94851: fix immortal objects refcounting in compiler (gh-95040)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 20 Jul 2022 10:42:05 +0000 (03:42 -0700)
committerGitHub <noreply@github.com>
Wed, 20 Jul 2022 10:42:05 +0000 (03:42 -0700)
(cherry picked from commit 74761548862eb5a324c23d86a6233d884f386f2e)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Python/compile.c

index 42f3730e220f58896b948699bc2b857e60d7fb3d..3fe0930e7aebf0fbf216d8e1e661770ca9a3d266 100644 (file)
@@ -4912,7 +4912,7 @@ compiler_joined_str(struct compiler *c, expr_ty e)
     Py_ssize_t value_count = asdl_seq_LEN(e->v.JoinedStr.values);
     if (value_count > STACK_USE_GUIDELINE) {
         _Py_DECLARE_STR(empty, "");
-        ADDOP_LOAD_CONST_NEW(c, &_Py_STR(empty));
+        ADDOP_LOAD_CONST_NEW(c, Py_NewRef(&_Py_STR(empty)));
         ADDOP_NAME(c, LOAD_METHOD, &_Py_ID(join), names);
         ADDOP_I(c, BUILD_LIST, 0);
         for (Py_ssize_t i = 0; i < asdl_seq_LEN(e->v.JoinedStr.values); i++) {