summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-02-15 01:42:46 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-02-15 01:42:46 (GMT)
commitc39cd783fb9277ca98816d375471717aff6c6a74 (patch)
treea5730bf8be36342bd7d3a749236e1da8ea02cdc1 /Modules
parentff337ccd4bf9b6edea5aa25ea72f7d4c02a3bf47 (diff)
downloadcpython-c39cd783fb9277ca98816d375471717aff6c6a74.zip
cpython-c39cd783fb9277ca98816d375471717aff6c6a74.tar.gz
cpython-c39cd783fb9277ca98816d375471717aff6c6a74.tar.bz2
Issue #13015: Fix a possible reference leak in defaultdict.__repr__.
Patch by Suman Saha.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_collectionsmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index ea5f779..ccc3043 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -1475,8 +1475,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 = PyString_FromString("...");
}
else