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