From 8cdd24ddd7d07a1cc6dda42a202bb66b756c5f63 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Thu, 27 Apr 2023 22:28:24 +0900 Subject: [PATCH] gh-103906: Remove immortal refcounting in compile.c --- Python/compile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index a0ad3687f586d8..0dc85e11cebf6a 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -892,10 +892,10 @@ static PyObject* merge_consts_recursive(PyObject *const_cache, PyObject *o) { assert(PyDict_CheckExact(const_cache)); - // None and Ellipsis are singleton, and key is the singleton. + // None and Ellipsis are immortal object, and key is the singleton. // No need to merge object and key. if (o == Py_None || o == Py_Ellipsis) { - return Py_NewRef(o); + return o; } PyObject *key = _PyCode_ConstantKey(o);