Skip to content

Commit ace4d7f

Browse files
authored
gh-113787: Fix refleaks in test_capi (gh-113816)
Fix refleaks and a typo.
1 parent 61dd77b commit ace4d7f

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

Modules/_testcapi/vectorcall_limited.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,6 @@ _PyTestCapi_Init_VectorcallLimited(PyObject *m) {
195195
if (PyModule_AddType(m, (PyTypeObject *)LimitedVectorCallClass) < 0) {
196196
return -1;
197197
}
198-
198+
Py_DECREF(LimitedVectorCallClass);
199199
return 0;
200200
}

Modules/_testcapimodule.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ get_testcapi_state(PyObject *module)
4949

5050
static PyObject *
5151
get_testerror(PyObject *self) {
52-
testcapistate_t *state = get_testcapi_state((PyObject *)Py_TYPE(self));
52+
testcapistate_t *state = get_testcapi_state(self);
5353
return state->error;
5454
}
5555

@@ -3947,7 +3947,6 @@ PyInit__testcapi(void)
39473947

39483948
testcapistate_t *state = get_testcapi_state(m);
39493949
state->error = PyErr_NewException("_testcapi.error", NULL, NULL);
3950-
Py_INCREF(state->error);
39513950
PyModule_AddObject(m, "error", state->error);
39523951

39533952
if (PyType_Ready(&ContainerNoGC_type) < 0) {

0 commit comments

Comments
 (0)