[Python-checkins] GH-94851: fix immortal objects refcounting in compiler (gh-95040)

corona10 webhook-mailer at python.org
Wed Jul 20 05:53:44 EDT 2022


https://github.com/python/cpython/commit/74761548862eb5a324c23d86a6233d884f386f2e
commit: 74761548862eb5a324c23d86a6233d884f386f2e
branch: main
author: Kumar Aditya <59607654+kumaraditya303 at users.noreply.github.com>
committer: corona10 <donghee.na92 at gmail.com>
date: 2022-07-20T18:53:27+09:00
summary:

GH-94851: fix immortal objects refcounting in compiler (gh-95040)

files:
M Python/compile.c

diff --git a/Python/compile.c b/Python/compile.c
index 30d8fdbb969ba..20eca059d30f1 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -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++) {



More information about the Python-checkins mailing list