8000 gh-122306: Fix circular reference issue between MemoryView and PickleBuffer during garbage collection by marko1616 · Pull Request #123400 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-122306: Fix circular reference issue between MemoryView and PickleBuffer during garbage collection #123400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change implementation
  • Loading branch information
marko1616 committed Sep 9, 2024
commit 2c8af2afa2c37893f8693a268b9b458e65a75526
8 changes: 2 additions & 6 deletions Objects/memoryobject.c
9D32
Original file line number Diff line number Diff line change
Expand Up @@ -1102,10 +1102,6 @@ PyBuffer_ToContiguous(void *buf, const Py_buffer *src, Py_ssize_t len, char orde
static int
_memory_release(PyMemoryViewObject *self)
{
/* this could be NULL if there is a PickleBuffer in cyclic references */
if(self->mbuf == NULL)
return 0;

if (self->flags & _Py_MEMORYVIEW_RELEASED)
return 0;

Expand Down Expand Up @@ -1168,8 +1164,8 @@ static int
memory_clear(PyObject *_self)
{
PyMemoryViewObject *self = (PyMemoryViewObject *)_self;
(void)_memory_release(self);
Py_CLEAR(self->mbuf);
if(_memory_release(self) == 0)
Py_CLEAR(self->mbuf);
return 0;
}

Expand Down
0