Mercurial > cpython-lru_cache-weakref
diff Modules/arraymodule.c @ 15396:b71459aeda95 legacy-trunk
Fix for SF bug 117402, crashes on str(array) and repr(array). This was an
unfortunate consequence of somebody switching from PyArg_Parse to
PyArg_ParseTuple but without changing the argument from a NULL to a tuple.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Fri, 10 Nov 2000 19:04:19 +0000 |
| parents | 25ddd3dc7a7a |
| children | 54205828b1e1 |
line wrap: on
line diff
--- a/Modules/arraymodule.c Thu Nov 09 21:14:40 2000 +0000 +++ b/Modules/arraymodule.c Fri Nov 10 19:04:19 2000 +0000 @@ -1191,7 +1191,6 @@ { int ok = 0; int i, len; - PyObject *t_empty = PyTuple_New(0); PyObject *v; len = a->ob_size; if (len == 0) { @@ -1199,9 +1198,10 @@ return ok; } if (a->ob_descr->typecode == 'c') { + PyObject *t_empty = PyTuple_New(0); fprintf(fp, "array('c', "); v = array_tostring(a, t_empty); - Py_DECREF(t_empty);; + Py_DECREF(t_empty); ok = PyObject_Print(v, fp, 0); Py_XDECREF(v); fprintf(fp, ")"); @@ -1231,9 +1231,11 @@ return PyString_FromString(buf); } if (a->ob_descr->typecode == 'c') { + PyObject *t_empty = PyTuple_New(0); sprintf(buf, "array('c', "); s = PyString_FromString(buf); - v = array_tostring(a, (PyObject *)NULL); + v = array_tostring(a, t_empty); + Py_DECREF(t_empty); t = PyObject_Repr(v); Py_XDECREF(v); PyString_ConcatAndDel(&s, t);
