gh-113787: Fix refleaks in test_capi (gh-113816)

Fix refleaks and a typo.
This commit is contained in:
neonene 2024-01-09 01:34:51 +09:00 committed by GitHub
parent 61dd77b04e
commit ace4d7ff9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -195,6 +195,6 @@ _PyTestCapi_Init_VectorcallLimited(PyObject *m) {
if (PyModule_AddType(m, (PyTypeObject *)LimitedVectorCallClass) < 0) {
return -1;
}
Py_DECREF(LimitedVectorCallClass);
return 0;
}

View File

@ -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) {