]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-101101: Fix test_code_extra to reset value for refleak test (gh-102350)
authorDong-hee Na <donghee.na@python.org>
Thu, 2 Mar 2023 11:32:05 +0000 (20:32 +0900)
committerGitHub <noreply@github.com>
Thu, 2 Mar 2023 11:32:05 +0000 (20:32 +0900)
Modules/_testcapi/code.c

index 588dc67971ea5a2afeb173e783b37cb565d74bfd..84c668cd6b3b00c406218d49808422f1a3bce8a4 100644 (file)
@@ -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);