https://github.com/python/cpython/commit/ace4d7ff9a247cbe7350719b996a1c7d88a57813
commit: ace4d7ff9a247cbe7350719b996a1c7d88a57813
branch: main
author: neonene <[email protected]>
committer: nascheme <[email protected]>
date: 2024-01-08T08:34:51-08:00
summary:
gh-113787: Fix refleaks in test_capi (gh-113816)
Fix refleaks and a typo.
files:
M Modules/_testcapi/vectorcall_limited.c
M Modules/_testcapimodule.c
diff --git a/Modules/_testcapi/vectorcall_limited.c
b/Modules/_testcapi/vectorcall_limited.c
index d7b8d33b7f7162..d7070d37bb9e9b 100644
--- a/Modules/_testcapi/vectorcall_limited.c
+++ b/Modules/_testcapi/vectorcall_limited.c
@@ -195,6 +195,6 @@ _PyTestCapi_Init_VectorcallLimited(PyObject *m) {
if (PyModule_AddType(m, (PyTypeObject *)LimitedVectorCallClass) < 0) {
return -1;
}
-
+ Py_DECREF(LimitedVectorCallClass);
return 0;
}
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 6762c611fb12a2..398570ff8e05c6 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -49,7 +49,7 @@ get_testcapi_state(PyObject *module)
static PyObject *
get_testerror(PyObject *self) {
- testcapistate_t *state = get_testcapi_state((PyObject *)Py_TYPE(self));
+ testcapistate_t *state = get_testcapi_state(self);
return state->error;
}
@@ -3947,7 +3947,6 @@ PyInit__testcapi(void)
testcapistate_t *state = get_testcapi_state(m);
state->error = PyErr_NewException("_testcapi.error", NULL, NULL);
- Py_INCREF(state->error);
PyModule_AddObject(m, "error", state->error);
if (PyType_Ready(&ContainerNoGC_type) < 0) {
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]