Skip to content

Commit 2c8af2a

Browse files
committed
Change implementation
1 parent 11a0d97 commit 2c8af2a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Objects/memoryobject.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,10 +1102,6 @@ PyBuffer_ToContiguous(void *buf, const Py_buffer *src, Py_ssize_t len, char orde
11021102
static int
11031103
_memory_release(PyMemoryViewObject *self)
11041104
{
1105-
/* this could be NULL if there is a PickleBuffer in cyclic references */
1106-
if(self->mbuf == NULL)
1107-
return 0;
1108-
11091105
if (self->flags & _Py_MEMORYVIEW_RELEASED)
11101106
return 0;
11111107

@@ -1168,8 +1164,8 @@ static int
11681164
memory_clear(PyObject *_self)
11691165
{
11701166
PyMemoryViewObject *self = (PyMemoryViewObject *)_self;
1171-
(void)_memory_release(self);
1172-
Py_CLEAR(self->mbuf);
1167+
if(_memory_release(self) == 0)
1168+
Py_CLEAR(self->mbuf);
11731169
return 0;
11741170
}
11751171

0 commit comments

Comments
 (0)