Commit 662cc6b2 authored by Stefan Behnel's avatar Stefan Behnel

Also mark the case of an uninitialised memory view slice as "unlikely()" when...

Also mark the case of an uninitialised memory view slice as "unlikely()" when refcounting it since it's most probably not a performance critical case.
parent c9c467f2
......@@ -485,7 +485,7 @@ __Pyx_INC_MEMVIEW({{memviewslice_name}} *memslice, int have_gil, int lineno)
{
int first_time;
struct {{memview_struct_name}} *memview = memslice->memview;
if (!memview || (PyObject *) memview == Py_None)
if (unlikely(!memview || (PyObject *) memview == Py_None))
return; /* allow uninitialized memoryview assignment */
if (unlikely(__pyx_get_slice_count(memview) < 0))
......@@ -510,9 +510,8 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW({{memviewslice_name}} *memslice,
int last_time;
struct {{memview_struct_name}} *memview = memslice->memview;
if (!memview ) {
return;
} else if ((PyObject *) memview == Py_None) {
if (unlikely(!memview || (PyObject *) memview == Py_None)) {
// we do not ref-count None
memslice->memview = NULL;
return;
}
......
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