[Python-3000-checkins] r56288 - python/branches/py3k-struni/Objects/unicodeobject.c

guido.van.rossum python-3000-checkins at python.org
Thu Jul 12 09:53:00 CEST 2007


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;
 }
 


More information about the Python-3000-checkins mailing list