summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-02-15 01:43:47 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-02-15 01:43:47 (GMT)
commit15af7b4a4f38be7155c4186624d67dc12764aceb (patch)
treedf4bfdb89d0a1ad1a1d4605c6d020c8759a6be09 /Modules
parent0568d6fd4e048c0fb3ffca0f9c8005e3f1256203 (diff)
parentf5f1fe0cb5dedf37098622de318656003dc5230d (diff)
downloadcpython-15af7b4a4f38be7155c4186624d67dc12764aceb.zip
cpython-15af7b4a4f38be7155c4186624d67dc12764aceb.tar.gz
cpython-15af7b4a4f38be7155c4186624d67dc12764aceb.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 efce5ce..dc18e7e 100644
--- a/Modules/_collectionsmodule.c
+++ b/Modules/_collectionsmodule.c
@@ -1403,8 +1403,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