Skip to content

Handle unhashable modules in constants collection#4661

Merged
Zac-HD merged 2 commits intoHypothesisWorks:masterfrom
Zac-HD:claude/fix-issue-4660-v47Zs
Feb 16, 2026
Merged

Handle unhashable modules in constants collection#4661
Zac-HD merged 2 commits intoHypothesisWorks:masterfrom
Zac-HD:claude/fix-issue-4660-v47Zs

Conversation

@Zac-HD
Copy link
Copy Markdown
Member

@Zac-HD Zac-HD commented Feb 13, 2026

Closes #4660

Some packages (e.g. cog) place unhashable objects like SimpleNamespace
in sys.modules. This caused a TypeError when _get_local_constants tried
to build a set from sys.modules.values(). Fix by catching TypeError on
the membership check and falling back to tracking by module name (the
str key in sys.modules) for unhashable entries.

https://claude.ai/code/session_01PQkqWu11828t7hwzAyR1sZ
- Use :class:`~types.SimpleNamespace` cross-ref in RELEASE.rst
- Wrap sys.modules.items() in list() to snapshot against concurrent mutation
- Add regression test for unhashable sys.modules entries

https://claude.ai/code/session_01PQkqWu11828t7hwzAyR1sZ
@Zac-HD Zac-HD requested a review from Liam-DeVoe as a code owner February 13, 2026 02:26
@Zac-HD Zac-HD enabled auto-merge February 13, 2026 02:52
@Zac-HD Zac-HD disabled auto-merge February 16, 2026 10:56
@Zac-HD Zac-HD merged commit f431fd1 into HypothesisWorks:master Feb 16, 2026
78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: unhashable type: 'types.SimpleNamespace'

2 participants