summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2023-03-02 11:32:05 (GMT)
committerGitHub <noreply@github.com>2023-03-02 11:32:05 (GMT)
commited55c69ebd74178115cd8b080f7f8e7588cd5fda (patch)
tree95facee0395a77c7666046332d0043cf36fd4140
parent60597439ef482a840f8ffc76eb6c27f3ba773d9c (diff)
downloadcpython-ed55c69ebd74178115cd8b080f7f8e7588cd5fda.zip
cpython-ed55c69ebd74178115cd8b080f7f8e7588cd5fda.tar.gz
cpython-ed55c69ebd74178115cd8b080f7f8e7588cd5fda.tar.bz2
gh-101101: Fix test_code_extra to reset value for refleak test (gh-102350)
-rw-r--r--Modules/_testcapi/code.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_testcapi/code.c b/Modules/_testcapi/code.c
index 588dc67..84c668c 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);