Title: PEP 688: Crash if `__release_buffer__` is called while an exception is active · Issue #104371 · python/cpython · GitHub
Open Graph Title: PEP 688: Crash if `__release_buffer__` is called while an exception is active · Issue #104371 · python/cpython
X Title: PEP 688: Crash if `__release_buffer__` is called while an exception is active · Issue #104371 · python/cpython
Description: class A: def __buffer__(self, flags): return memoryview(bytes(8)) def __release_buffer__(self, view): pass # do not need to do anything here, just needs to exist b = bytearray(8) m = memoryview(b) # now b.extend will raise an exception d...
Open Graph Description: class A: def __buffer__(self, flags): return memoryview(bytes(8)) def __release_buffer__(self, view): pass # do not need to do anything here, just needs to exist b = bytearray(8) m = memoryview(b) ...
X Description: class A: def __buffer__(self, flags): return memoryview(bytes(8)) def __release_buffer__(self, view): pass # do not need to do anything here, just needs to exist b = bytearray(8) m = memoryview(b) ...
Opengraph URL: https://github.com/python/cpython/issues/104371
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PEP 688: Crash if `__release_buffer__` is called while an exception is active","articleBody":"```\r\nclass A:\r\n def __buffer__(self, flags):\r\n return memoryview(bytes(8))\r\n def __release_buffer__(self, view):\r\n pass # do not need to do anything here, just needs to exist\r\n\r\nb = bytearray(8)\r\nm = memoryview(b) # now b.extend will raise an exception due to exports\r\nb.extend(A())\r\n```\r\nIn a debug build this crashes with `Assertion failed: (!PyErr_Occurred()), function _PyType_Lookup, file typeobject.c, line 4707.`\r\n\r\nReported by @chilaxan. I'll work on a fix later today.\r\n\r\nMost likely, the fix will be to call `PyErr_Fetch`/`PyErr_Restore` around calls to Python `__release_buffer__` methods.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-104378\n* gh-104417\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/JelleZijlstra","@type":"Person","name":"JelleZijlstra"},"datePublished":"2023-05-10T21:56:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/104371/cpython/issues/104371"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:57bb6c84-97e1-4981-6980-b78217fe6ab8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A552:2171D7:4A4D75:678BBC:696A2268 |
| html-safe-nonce | 9740587f3bf8ee413fa8c17886e936ac8d75b5d1c2bc8ff0b4d4ec2cf399377f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTUyOjIxNzFENzo0QTRENzU6Njc4QkJDOjY5NkEyMjY4IiwidmlzaXRvcl9pZCI6IjUyMzQ1MDI0MTQ2NTQ2NDQ4NDAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3a30f68c1e3fb11f4e7620f46e18a2bad44d066c0d2e6395cd2fa3e4d4a97520 |
| hovercard-subject-tag | issue:1704680526 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/104371/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c27f3f9a716e919f13f463ec1844e19d2e9cb15ea010a339d277f906d5d246f4/python/cpython/issues/104371 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c27f3f9a716e919f13f463ec1844e19d2e9cb15ea010a339d277f906d5d246f4/python/cpython/issues/104371 |
| og:image:alt | class A: def __buffer__(self, flags): return memoryview(bytes(8)) def __release_buffer__(self, view): pass # do not need to do anything here, just needs to exist b = bytearray(8) m = memoryview(b) ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JelleZijlstra |
| hostname | github.com |
| expected-hostname | github.com |
| None | 014f3d193f36b7d393f88ca22d06fbacd370800b40a547c1ea67291e02dc8ea3 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d515f6f09fa57a93bf90355cb894eb84ca4f458f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width