]> granicus.if.org Git - python/commitdiff
Fix refleak in internal_print() introduced by myself in r81251
authorVictor Stinner <victor.stinner@haypocalc.com>
Mon, 17 May 2010 09:33:42 +0000 (09:33 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Mon, 17 May 2010 09:33:42 +0000 (09:33 +0000)
_PyUnicode_AsDefaultEncodedString() uses a magical PyUnicode attribute to
automatically destroy PyUnicode_EncodeUTF8() result when the unicode string is
destroyed.

Objects/object.c

index 1f4e3dd445ffcc3d41895abd7ebc02aef6ce1dc8..7907a8e566a35aa2b5d071f976e64a2f6146852d 100644 (file)
@@ -311,6 +311,7 @@ internal_print(PyObject *op, FILE *fp, int flags, int nesting)
                 else {
                     fwrite(PyBytes_AS_STRING(t), 1,
                            PyBytes_GET_SIZE(t), fp);
+                    Py_DECREF(t);
                 }
             }
             else {