Commits

Antoine Pitrou  committed 7cfce71 Merge

Issue #13015: Fix a possible reference leak in defaultdict.__repr__.
Patch by Suman Saha.

  • Participants
  • Parent commits 81f3bb5, 86adb5c

Comments (0)

Files changed (2)

 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.

File Modules/_collectionsmodule.c

     {
         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