Title: `deque_clear` clears `MemoryError` · Issue #152017 · python/cpython · GitHub
Open Graph Title: `deque_clear` clears `MemoryError` · Issue #152017 · python/cpython
X Title: `deque_clear` clears `MemoryError` · Issue #152017 · python/cpython
Description: Bug report Bug description: This is a sub-issue for gh-146102 with the gist here. In the case that there is no memory, deque_clear calls PyErr_Clear(): cpython/Modules/_collectionsmodule.c Lines 749 to 753 in 7928a8b b = newblock(deque);...
Open Graph Description: Bug report Bug description: This is a sub-issue for gh-146102 with the gist here. In the case that there is no memory, deque_clear calls PyErr_Clear(): cpython/Modules/_collectionsmodule.c Lines 74...
X Description: Bug report Bug description: This is a sub-issue for gh-146102 with the gist here. In the case that there is no memory, deque_clear calls PyErr_Clear(): cpython/Modules/_collectionsmodule.c Lines 74...
Opengraph URL: https://github.com/python/cpython/issues/152017
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`deque_clear` clears `MemoryError`","articleBody":"# Bug report\n\n### Bug description:\n\n\nThis is a sub-issue for gh-146102 with the gist [here](https://gist.github.com/devdanzin/c0e661ad36a12581333740414e20098e).\n---\n\nIn the case that there is no memory, `deque_clear` calls `PyErr_Clear()`:\nhttps://github.com/python/cpython/blob/7928a8b730b0334c9f97c2144ab00fe0d88f1e97/Modules/_collectionsmodule.c#L749-L753\n\nThis was done to clear the error that `newblock` raises. However, if there was originally an exception, `deque_clear` clears it.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-152018\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/brijkapadia","@type":"Person","name":"brijkapadia"},"datePublished":"2026-06-23T14:56:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/152017/cpython/issues/152017"}
| 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:c127d822-9962-dbf1-4ac7-b042f187dc5e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BF18:DC47A:19AD273:2480CF0:6A50C87D |
| html-safe-nonce | 5c89c1130b66ebd107f519a019c396efeb17616704f7a1609767e4da1a24e9bd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRjE4OkRDNDdBOjE5QUQyNzM6MjQ4MENGMDo2QTUwQzg3RCIsInZpc2l0b3JfaWQiOiI4NDgzMDU0NDQ0MjkxODY4Nzk3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | cf06a2275d34ba50148944437e8d4372146ac3b9b578a7a49b22495f26585aac |
| hovercard-subject-tag | issue:4726989890 |
| 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/152017/issue_layout |
| twitter:image | https://opengraph.githubassets.com/54e5e74a55ef2f09e945905b65fe517c0eb10a63909fe2ae807359afeab4dee8/python/cpython/issues/152017 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/54e5e74a55ef2f09e945905b65fe517c0eb10a63909fe2ae807359afeab4dee8/python/cpython/issues/152017 |
| og:image:alt | Bug report Bug description: This is a sub-issue for gh-146102 with the gist here. In the case that there is no memory, deque_clear calls PyErr_Clear(): cpython/Modules/_collectionsmodule.c Lines 74... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | brijkapadia |
| hostname | github.com |
| expected-hostname | github.com |
| None | 72b13e0e8d0319acdd27a145cfe73f4f06c791713d0ac4690e41fb68ad28cac0 |
| 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 | 08e79d53fc070870d5b168356afebb1e286a2ffe |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width