summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-01-30 11:28:29 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-01-30 11:28:29 (GMT)
commit2c4a07249f736c0502b79db63d400928f6aa0484 (patch)
tree07f0a3f07e668bfe02adf4df8e8bd538fcc8b74c /Objects
parentc04dac08c4c3c9111aa0f731315057e6d5f6f21a (diff)
downloadcpython-2c4a07249f736c0502b79db63d400928f6aa0484.zip
cpython-2c4a07249f736c0502b79db63d400928f6aa0484.tar.gz
cpython-2c4a07249f736c0502b79db63d400928f6aa0484.tar.bz2
Fixed issue #1973: bytes.fromhex('') raises SystemError
Diffstat (limited to 'Objects')
-rw-r--r--Objects/stringobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 011fc32..d714a77 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -2772,7 +2772,7 @@ string_fromhex(PyObject *cls, PyObject *args)
}
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 @@ string_getnewargs(PyStringObject *v)
return Py_BuildValue("(s#)", v->ob_sval, Py_SIZE(v));
}
-
+
static PyMethodDef
string_methods[] = {
{"__getnewargs__", (PyCFunction)string_getnewargs, METH_NOARGS},