Title: _interpchannels: `ChannelID.__eq__` reads module state from sys.modules without a check · Issue #161841 · python/cpython · GitHub
Open Graph Title: _interpchannels: `ChannelID.__eq__` reads module state from sys.modules without a check · Issue #161841 · python/cpython
X Title: _interpchannels: `ChannelID.__eq__` reads module state from sys.modules without a check · Issue #161841 · python/cpython
Description: Bug report Summary ChannelID comparison looks the extension module up by name in sys.modules and reads its state with PyModule_GetState, without checking that the object found is this extension's module. If the entry is replaced with a p...
Open Graph Description: Bug report Summary ChannelID comparison looks the extension module up by name in sys.modules and reads its state with PyModule_GetState, without checking that the object found is this extension's m...
X Description: Bug report Summary ChannelID comparison looks the extension module up by name in sys.modules and reads its state with PyModule_GetState, without checking that the object found is this extension'...
Opengraph URL: https://github.com/python/cpython/issues/161841
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"_interpchannels: `ChannelID.__eq__` reads module state from sys.modules without a check","articleBody":"### Bug report\n\n## Summary\n\n`ChannelID` comparison looks the extension module up by name in `sys.modules` and reads its state with `PyModule_GetState`, without checking that the object found is this extension's module.\n\nIf the entry is replaced with a plain module, `PyModule_GetState` returns `NULL` without setting an exception, and the comparison returns `NULL`, which the interpreter reports as a `SystemError`.\n\nExpected: a normal comparison result, or a clear exception.\n\n## Reproducer\n\n```python\nimport sys, types\nimport _interpchannels as ch\n\ncid = ch.create()\nsys.modules[\"_interpchannels\"] = types.ModuleType(\"_interpchannels\")\ncid == 1\n```\n\n```console\nSystemError: error return without exception set\n```\n\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-161869\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/grgalex","@type":"Person","name":"grgalex"},"datePublished":"2026-11-12T00:06:42Z","url":"https://github.com/python/cpython/issues/161841"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:eeddd02c-6b27-764a-eb43-ff74e4a0084d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DDD0:2454CC:4E72726:633FA3F:6B026C08 |
| html-safe-nonce | 20901d859162161466828ac45a20941c79c0c474ffc3764540ac67a421d73bad |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEREQwOjI0NTRDQzo0RTcyNzI2OjYzM0ZBM0Y6NkIwMjZDMDgiLCJ2aXNpdG9yX2lkIjoiNzA4OTM4NTQ3OTk5NjU5OTMwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | fdcb6ab09045c2b9d003b68d08f1fff932f2ded468a85792e3ec78875dd66449 |
| hovercard-subject-tag | issue:6339572308 |
| 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/161841/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8fba1df8b1a70ed9b4d89b75ff311c2416df4265614e672aee2573b4af6cefc1/python/cpython/issues/161841 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8fba1df8b1a70ed9b4d89b75ff311c2416df4265614e672aee2573b4af6cefc1/python/cpython/issues/161841 |
| og:image:alt | Bug report Summary ChannelID comparison looks the extension module up by name in sys.modules and reads its state with PyModule_GetState, without checking that the object found is this extension's m... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | grgalex |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width