Author: guido.van.rossum
Date: Thu Jul 12 09:53:00 2007
New Revision: 56288

Modified:
   python/branches/py3k-struni/Objects/unicodeobject.c
Log:
Fixed a refcount leak in _PyUnicode_AsDefaultEncodedString().
Found by Amaury Forgeot d'Arc, SF# 1752317.
(Also removed a redundant check for !errors.)


Modified: python/branches/py3k-struni/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k-struni/Objects/unicodeobject.c (original)
+++ python/branches/py3k-struni/Objects/unicodeobject.c Thu Jul 12 09:53:00 2007
@@ -1206,10 +1206,7 @@
     v = PyString_FromStringAndSize(PyBytes_AsString(b),
                                    PyBytes_Size(b));
     Py_DECREF(b);
-    if (!errors) {
-        Py_XINCREF(v);
-        ((PyUnicodeObject *)unicode)->defenc = v;
-    }
+    ((PyUnicodeObject *)unicode)->defenc = v;
     return v;
 }
 
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to