Commit 6a0ae8ec authored by Robert Bradshaw's avatar Robert Bradshaw

Merge branch 'master' into 0.25.x

parents 4bf8b9b2 176ed5e4
......@@ -950,8 +950,11 @@ static void __Pyx_Coroutine_del(PyObject *self) {
static PyObject *
__Pyx_Coroutine_get_name(__pyx_CoroutineObject *self)
{
Py_INCREF(self->gi_name);
return self->gi_name;
PyObject *name = self->gi_name;
// avoid NULL pointer dereference during garbage collection
if (unlikely(!name)) name = Py_None;
Py_INCREF(name);
return name;
}
static int
......@@ -978,8 +981,11 @@ __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value)
static PyObject *
__Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self)
{
Py_INCREF(self->gi_qualname);
return self->gi_qualname;
PyObject *name = self->gi_qualname;
// avoid NULL pointer dereference during garbage collection
if (unlikely(!name)) name = Py_None;
Py_INCREF(name);
return name;
}
static int
......
......@@ -121,12 +121,12 @@ static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) {
static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) {
void *items = (void*) self->data.ob_item;
Py_ssize_t newsize;
if (n < self->ob_size) {
if (n < self->allocated && n*4 > self->allocated) {
self->ob_size = n;
return 0;
}
newsize = n + (n / 2) + 1;
if (newsize <= self->allocated) { /* overflow */
if (newsize <= n) { /* overflow */
PyErr_NoMemory();
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