Issue #13015: Fix a possible reference leak in defaultdict.__repr__.

Patch by Suman Saha.
This commit is contained in:
Antoine Pitrou 2012-02-15 02:43:47 +01:00
commit 15af7b4a4f
2 changed files with 6 additions and 1 deletions

View File

@ -466,6 +466,9 @@ Core and Builtins
Library
-------
- Issue #13015: Fix a possible reference leak in defaultdict.__repr__.
Patch by Suman Saha.
- Issue #10287: nntplib now queries the server's CAPABILITIES first before
sending MODE READER, and only sends it if not already in READER mode.
Patch by Hynek Schlawack.

View File

@ -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