GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — _interpchannels: `ChannelID.__eq__` reads module state from sys.modules without a check · Issue #161841 · python/cpython

_interpchannels: ChannelID.__eq__ reads module state from sys.modules without a check #161841

New issue
Copy link
New issue
Copy link
Open
Open
_interpchannels: ChannelID.__eq__ reads module state from sys.modules without a check#161841
Copy link
Labels
extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-subinterpreterstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@grgalex
grgalex
opened on Nov 12, 2026
Issue body actions

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 plain module, PyModule_GetState returns NULL without setting an exception, and the comparison returns NULL, which the interpreter reports as a SystemError.

Expected: a normal comparison result, or a clear exception.

Reproducer

import sys, types
import _interpchannels as ch

cid = ch.create()
sys.modules["_interpchannels"] = types.ModuleType("_interpchannels")
cid == 1
SystemError: error return without exception set

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Activity

  1. grgalex
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Nov 12, 2026
  2. ZeroIntensity commented on Nov 12, 2026

    @ZeroIntensity
    ZeroIntensity
    on Nov 12, 2026
    Member
    More actions

    Before you file a bunch more AI-found issues: please instead compile your findings into a single gist and create one umbrella issue for them.

  3. grgalex commented on Nov 12, 2026

    @grgalex
    grgalex
    on Nov 12, 2026
    ContributorAuthor
    More actions

    @ZeroIntensity They are not AI found, there are still people out there doing classic program analysis 😛

    (In this case we are developing a type-checking tool for native extensions)

    I acknowledge that opening separate issues leads to spam. When we find (at least one) more, I will open an umbrella issue and keep adding any future ones there, since in general the underlying root causes are the same.

    Funny story, we had collaborated on my first CPython issue/PR last year (#126555), and in that case I had found the bug with my eyes.

    Now I've evolved to using static analysis (here) and dynamic analysis (#157614). Thankfully not yet opening AI-found issues!

  4. ZeroIntensity commented on Nov 12, 2026

    @ZeroIntensity
    ZeroIntensity
    on Nov 12, 2026
    Member
    More actions

    Ah, okay! But, my comment above still applies, unless you only have a handful of issues (1-8 or so). We've had some issues in the past with people flooding us with a bunch of issue reports all at once. Nothing against you personally, but we don't want to send a message to the AI analyzers that that's okay :)

    Reacted by George Alexopoulos
  5. ZeroIntensity
    added
    extension-modulesC modules in the Modules dirC modules in the Modules dir
    topic-subinterpreters
    on Nov 12, 2026
  6. github-project-automation
    added this to Subinterpreterson Nov 12, 2026
  7. github-project-automation
    moved this to Todo in Subinterpreterson Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirC modules in the Modules dirtopic-subinterpreterstype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • Subinterpreters
      Status
      Todo
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.