Author: christian.heimes
Date: Wed Jan 30 12:28:29 2008
New Revision: 60439

Modified:
   python/branches/py3k/Objects/stringobject.c
Log:
Fixed issue #1973: bytes.fromhex('') raises SystemError

Modified: python/branches/py3k/Objects/stringobject.c
==============================================================================
--- python/branches/py3k/Objects/stringobject.c (original)
+++ python/branches/py3k/Objects/stringobject.c Wed Jan 30 12:28:29 2008
@@ -2772,7 +2772,7 @@
                }
                buf[j++] = (top << 4) + bot;
        }
-       if (_PyString_Resize(&newstring, j) < 0)
+       if (j != byteslen && _PyString_Resize(&newstring, j) < 0)
                goto error;
        return newstring;
 
@@ -2788,7 +2788,7 @@
        return Py_BuildValue("(s#)", v->ob_sval, Py_SIZE(v));
 }
 
-
+
 static PyMethodDef
 string_methods[] = {
        {"__getnewargs__",      (PyCFunction)string_getnewargs, METH_NOARGS},
_______________________________________________
Python-3000-checkins mailing list
Python-3000-checkins@python.org
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to