diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 156ad18..4f83a87 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -1400,8 +1400,10 @@ defdict_repr(defdictobject *dd) { int status = Py_ReprEnter(dd->default_factory); if (status != 0) { - if (status < 0) - return NULL; + if (status < 0) { + Py_DECREF(baserepr); + return NULL; + } defrepr = PyUnicode_FromString("..."); } else