[Python-checkins] gh-101101: Fix test_code_extra to reset value for refleak test (gh-102350)

corona10 webhook-mailer at python.org
Thu Mar 2 06:32:47 EST 2023


https://github.com/python/cpython/commit/ed55c69ebd74178115cd8b080f7f8e7588cd5fda
commit: ed55c69ebd74178115cd8b080f7f8e7588cd5fda
branch: main
author: Dong-hee Na <donghee.na at python.org>
committer: corona10 <donghee.na92 at gmail.com>
date: 2023-03-02T20:32:05+09:00
summary:

gh-101101: Fix test_code_extra to reset value for refleak test (gh-102350)

files:
M Modules/_testcapi/code.c

diff --git a/Modules/_testcapi/code.c b/Modules/_testcapi/code.c
index 588dc67971ea..84c668cd6b3b 100644
--- a/Modules/_testcapi/code.c
+++ b/Modules/_testcapi/code.c
@@ -92,7 +92,11 @@ test_code_extra(PyObject* self, PyObject *Py_UNUSED(callable))
         goto finally;
     }
     assert ((uintptr_t)extra == 77);
-
+    // Revert to initial code extra value.
+    res = PyUnstable_Code_SetExtra(test_func_code, code_extra_index, NULL);
+    if (res < 0) {
+        goto finally;
+    }
     result = Py_NewRef(Py_None);
 finally:
     Py_XDECREF(test_module);



More information about the Python-checkins mailing list