summaryrefslogtreecommitdiffstats
path: root/Modules/arraymodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r--Modules/arraymodule.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 3ed8a33..1d1f0d3 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -1380,6 +1380,11 @@ array_fromstring(arrayobject *self, PyObject *args)
int itemsize = self->ob_descr->itemsize;
if (!PyArg_ParseTuple(args, "s#:fromstring", &str, &n))
return NULL;
+ if (str == self->ob_item) {
+ PyErr_SetString(PyExc_ValueError,
+ "array.fromstring(x): x cannot be self");
+ return NULL;
+ }
if (n % itemsize != 0) {
PyErr_SetString(PyExc_ValueError,
"string length not a multiple of item size");