]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-94851: fix immortal objects refcounting in compiler (gh-95040)
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Wed, 20 Jul 2022 09:53:27 +0000 (15:23 +0530)
committerGitHub <noreply@github.com>
Wed, 20 Jul 2022 09:53:27 +0000 (18:53 +0900)
Python/compile.c

index 30d8fdbb969ba37b251e29bf57326efab8ed8528..20eca059d30f10be43e8c5378a79261541e43153 100644 (file)
@@ -4857,7 +4857,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++) {