commit | f5f1fe0cb5dedf37098622de318656003dc5230d | [log] [tgz] |
---|---|---|
author | Antoine Pitrou <solipsis@pitrou.net> | Wed Feb 15 02:42:46 2012 +0100 |
committer | Antoine Pitrou <solipsis@pitrou.net> | Wed Feb 15 02:42:46 2012 +0100 |
tree | f86c8e3abc437c9d409fe2caba69d4dc003f50a3 | |
parent | 71135624d81fac63a1684d5cf31932652f9250ff [diff] [blame] |
Issue #13015: Fix a possible reference leak in defaultdict.__repr__. Patch by Suman Saha.
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 5545d1e..4343159 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c
@@ -1401,8 +1401,10 @@ { int status = Py_ReprEnter(dd->default_factory); if (status != 0) { - if (status < 0) + if (status < 0) { + Py_DECREF(baserepr); return NULL; + } defrepr = PyUnicode_FromString("..."); } else