René's URL Explorer Experiment


Title: `_interpchannels`: missing `PyErr_NoMemory()` causes `SystemErroron` OOM in `{create,close}()` · Issue #150213 · python/cpython · GitHub

Open Graph Title: `_interpchannels`: missing `PyErr_NoMemory()` causes `SystemErroron` OOM in `{create,close}()` · Issue #150213 · python/cpython

X Title: `_interpchannels`: missing `PyErr_NoMemory()` causes `SystemErroron` OOM in `{create,close}()` · Issue #150213 · python/cpython

Description: Bug report Bug description: Bug description parent issue:#146102 refs:https://gist.github.com/devdanzin/d9975354c27e57f2589acfd0a777a2f1 Several allocation failure paths in Modules/_interpchannelsmodule.c return NULL or -1 without settin...

Open Graph Description: Bug report Bug description: Bug description parent issue:#146102 refs:https://gist.github.com/devdanzin/d9975354c27e57f2589acfd0a777a2f1 Several allocation failure paths in Modules/_interpchannelsm...

X Description: Bug report Bug description: Bug description parent issue:#146102 refs:https://gist.github.com/devdanzin/d9975354c27e57f2589acfd0a777a2f1 Several allocation failure paths in Modules/_interpchannelsm...

Opengraph URL: https://github.com/python/cpython/issues/150213

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`_interpchannels`: missing `PyErr_NoMemory()` causes `SystemErroron` OOM in `{create,close}()`","articleBody":"# Bug report\n\n### Bug description:\n\n## Bug description\nparent issue:https://github.com/python/cpython/issues/146102\nrefs:https://gist.github.com/devdanzin/d9975354c27e57f2589acfd0a777a2f1\n\nSeveral allocation failure paths in `Modules/_interpchannelsmodule.c`\nreturn `NULL` or `-1` without setting an exception.\n\nThis violates CPython's C API convention that an error return should have\nan exception set. In release builds, this can surface as:\n\n```text\nSystemError: \u003cbuilt-in function ...\u003e returned NULL without setting an exception\n```\n\ninstead of the expected `MemoryError`. In debug builds, the same paths may\ntrip `assert(PyErr_Occurred())` in `handle_channel_error()`.\n\n### Affected functions\n\nThe affected allocation sites are:\n\n| Function | Triggered via |\n|---|---|\n| `_channelends_new()` | `_channels.create()` |\n| `_channel_new()` | `_channels.create()` |\n| `_channelref_new()` | `_channels.create()` |\n| `_channel_set_closing()` | `_channels.close(send=True)` on a non-empty channel |\n\nNearby helper functions in the same file already handle this correctly by\ncalling `PyErr_NoMemory()` on allocation failure, for example:\n\n| Function |\n|---|\n| `_channelitem_new()` |\n| `_channelqueue_new()` |\n| `_channelend_new()` |\n\n### Reproducer\n\n```python\nimport _testcapi\nimport _interpchannels as _channels\nfrom concurrent.interpreters import _crossinterp\n\nREPLACE = _crossinterp._UNBOUND_CONSTANT_TO_FLAG[_crossinterp.UNBOUND]\n\n# Case 1: _channels.create()\nfor n in range(1, 20):\n    _testcapi.set_nomemory(n, n + 1)\n    try:\n        cid = _channels.create(REPLACE)\n    except MemoryError:\n        pass\n    except SystemError as exc:\n        print(f\"[create] n={n}: {type(exc).__name__}: {exc}\")\n    else:\n        _channels.destroy(cid)\n    finally:\n        _testcapi.remove_mem_hooks()\n\n# Case 2: _channels.close(send=True) on a non-empty channel\nfor n in range(1, 30):\n    cid = _channels.create(REPLACE)\n    _channels.send(cid, b\"spam\", blocking=False)\n    _testcapi.set_nomemory(n, n + 1)\n    try:\n        _channels.close(cid, send=True)\n    except MemoryError:\n        pass\n    except SystemError as exc:\n        print(f\"[close] n={n}: {type(exc).__name__}: {exc}\")\n    finally:\n        _testcapi.remove_mem_hooks()\n        try:\n            _channels.close(cid, force=True)\n        except Exception:\n            pass\n        try:\n            _channels.destroy(cid)\n        except Exception:\n            pass\n```\n\nSample output on main, CPython 3.16.0a0, macOS, release build:\n\n```text\n[create] n=1: SystemError: \u003cbuilt-in function create\u003e returned NULL without setting an exception\n[create] n=3: SystemError: \u003cbuilt-in function create\u003e returned NULL without setting an exception\n[create] n=4: SystemError: \u003cbuilt-in function create\u003e returned NULL without setting an exception\n[close] n=1: SystemError: \u003cbuilt-in function close\u003e returned NULL without setting an exception\n```\n\n### Expected behavior\n\nAll affected allocation failure paths should raise `MemoryError`, consistent\nwith nearby helper functions and CPython's general C API error handling\ncontract.\n\n### Fix\n\nCall `PyErr_NoMemory()` before returning an error from the affected\nallocation failure paths.\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-150214\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/lpyu001","@type":"Person","name":"lpyu001"},"datePublished":"2026-05-22T02:17:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/150213/cpython/issues/150213"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:99d99018-0122-0fc5-5b0a-35c6e1b00fba
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC1CC:322E35:982E4D8:D6AAC4F:6A5110C2
html-safe-nonce6ec30f594d48f181b1955ec7b250b1bdce00e7548872b032fbb81acca1c4cf97
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMUNDOjMyMkUzNTo5ODJFNEQ4OkQ2QUFDNEY6NkE1MTEwQzIiLCJ2aXNpdG9yX2lkIjoiMjYzNzgyNTkzOTgyMDU4MTA1OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmace4c6cd85abbb19c6bc2fcfe8596319c7b163a190b04f21841c641c62e8ae56e9
hovercard-subject-tagissue:4499268950
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/150213/issue_layout
twitter:imagehttps://opengraph.githubassets.com/6a7088ae471a2557733955407c65a80c54782862da0e9f98dc3fbdb5dd67453f/python/cpython/issues/150213
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/6a7088ae471a2557733955407c65a80c54782862da0e9f98dc3fbdb5dd67453f/python/cpython/issues/150213
og:image:altBug report Bug description: Bug description parent issue:#146102 refs:https://gist.github.com/devdanzin/d9975354c27e57f2589acfd0a777a2f1 Several allocation failure paths in Modules/_interpchannelsm...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamelpyu001
hostnamegithub.com
expected-hostnamegithub.com
Noneb076e100febaa00374cd89239f915d00dd3187f7c68b12bc2b7688181305344d
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef9137f6d981cbbfd780af369f80ce890b2d0d2d4
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/150213#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F150213
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F150213
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/150213
Reloadhttps://github.com/python/cpython/issues/150213
Reloadhttps://github.com/python/cpython/issues/150213
Please reload this pagehttps://github.com/python/cpython/issues/150213
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/150213
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 35k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 73.7k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.3k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality 0 https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security and quality https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
_interpchannels: missing PyErr_NoMemory() causes SystemErroron OOM in {create,close}()https://github.com/python/cpython/issues/150213#top
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
topic-subinterpretershttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-subinterpreters%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/lpyu001
lpyu001https://github.com/lpyu001
on May 22, 2026https://github.com/python/cpython/issues/150213#issue-4499268950
#146102https://github.com/python/cpython/issues/146102
https://gist.github.com/devdanzin/d9975354c27e57f2589acfd0a777a2f1https://gist.github.com/devdanzin/d9975354c27e57f2589acfd0a777a2f1
gh-150213: Fix OOM error handling in _interpchannels #150214https://github.com/python/cpython/pull/150214
extension-modulesC modules in the Modules dirhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22extension-modules%22
topic-subinterpretershttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-subinterpreters%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
Subinterpretershttps://github.com/orgs/python/projects/3
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.