Commit 8e8e5185 authored by Robert Bradshaw's avatar Robert Bradshaw

Cleaner overflow detection.

parent b77debf7
...@@ -126,7 +126,7 @@ static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) { ...@@ -126,7 +126,7 @@ static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) {
return 0; return 0;
} }
newsize = n + (n / 2) + 1; newsize = n + (n / 2) + 1;
if (newsize <= self->allocated) { /* overflow */ if (newsize <= n) { /* overflow */
PyErr_NoMemory(); PyErr_NoMemory();
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment