diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-02-15 01:42:46 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-02-15 01:42:46 (GMT) |
commit | f5f1fe0cb5dedf37098622de318656003dc5230d (patch) | |
tree | f86c8e3abc437c9d409fe2caba69d4dc003f50a3 /Modules/_collectionsmodule.c | |
parent | 71135624d81fac63a1684d5cf31932652f9250ff (diff) | |
download | cpython-f5f1fe0cb5dedf37098622de318656003dc5230d.zip cpython-f5f1fe0cb5dedf37098622de318656003dc5230d.tar.gz cpython-f5f1fe0cb5dedf37098622de318656003dc5230d.tar.bz2 |
Issue #13015: Fix a possible reference leak in defaultdict.__repr__.
Patch by Suman Saha.
Diffstat (limited to 'Modules/_collectionsmodule.c')
-rw-r--r-- | Modules/_collectionsmodule.c | 4 |
1 files changed, 3 insertions, 1 deletions
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 @@ defdict_repr(defdictobject *dd) { 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 |