From: Dong-hee Na Date: Thu, 2 Mar 2023 11:32:05 +0000 (+0900) Subject: gh-101101: Fix test_code_extra to reset value for refleak test (gh-102350) X-Git-Tag: v3.12.0a6~38 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ed55c69ebd74178115cd8b080f7f8e7588cd5fda;p=thirdparty%2FPython%2Fcpython.git gh-101101: Fix test_code_extra to reset value for refleak test (gh-102350) --- 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);