FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-77894: Fix a crash when the GC breaks a loop containing a memoryview by serhiy-storchaka · Pull Request #123898 · python/cpython · GitHub

/ cpython Public

gh-77894: Fix a crash when the GC breaks a loop containing a memoryview - #123898

Merged
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:memoryview-clear
Sep 11, 2024
Merged

gh-77894: Fix a crash when the GC breaks a loop containing a memoryview#123898
serhiy-storchaka merged 2 commits into
python:mainfrom
serhiy-storchaka:memoryview-clear

Conversation

serhiy-storchaka commented Sep 10, 2024
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

Now a memoryview object can only be cleared if there are no buffers that refer it.

…moryview

Now a memoryview object can only be cleared if there are no buffers
that refer it.

vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

Copy link
Copy Markdown
Member

Ah, test_pickle fails:

ERROR: test_non_continuous_buffer (test.test_pickle.PyPicklingErrorTests.test_non_continuous_buffer) (proto=5)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/pickletester.py", line 2330, in test_non_continuous_buffer
    self.dumps(pb, proto)
    ~~~~~~~~~~^^^^^^^^^^^
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/test/test_pickle.py", line 66, in dumps
    p.dump(arg)
    ~~~~~~^^^^^
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/pickle.py", line 499, in dump
    self.save(obj)
    ~~~~~~~~~^^^^^
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/pickle.py", line 572, in save
    f(self, obj)  # Call unbound method with explicit self
    ~^^^^^^^^^^^
  File "/home/runner/work/cpython/cpython-ro-srcdir/Lib/pickle.py", line 896, in save_picklebuffer
    with obj.raw() as m:
         ~~~~~~~^^
BufferError: cannot extract raw buffer from non-contiguous buffer

serhiy-storchaka merged commit a1dbf2e into python:main Sep 11, 2024

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

serhiy-storchaka deleted the memoryview-clear branch September 11, 2024 09:05
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 11, 2024
…moryview (pythonGH-123898)

Now a memoryview object can only be cleared if there are no buffers
that refer it.
(cherry picked from commit a1dbf2e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker a1dbf2ea69acc6ccee6292709af1dadd55c068be 3.12

bedevere-app Bot commented Sep 11, 2024

Copy link
Copy Markdown

GH-123936 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Sep 11, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Sep 11, 2024
…ng a memoryview (pythonGH-123898)

Now a memoryview object can only be cleared if there are no buffers
that refer it.
(cherry picked from commit a1dbf2e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

bedevere-app Bot commented Sep 11, 2024

Copy link
Copy Markdown

GH-123937 is a backport of this pull request to the 3.12 branch.

bedevere-app Bot removed the needs backport to 3.12 only security fixes label Sep 11, 2024
serhiy-storchaka added a commit that referenced this pull request Sep 11, 2024
…emoryview (GH-123898) (GH-123937)

Now a memoryview object can only be cleared if there are no buffers
that refer it.
(cherry picked from commit a1dbf2e)
Yhg1s pushed a commit that referenced this pull request Sep 30, 2024
…emoryview (GH-123898) (#123936)

gh-77894: Fix a crash when the GC breaks a loop containing a memoryview (GH-123898)

Now a memoryview object can only be cleared if there are no buffers
that refer it.
(cherry picked from commit a1dbf2e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka removed their assignment Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL