Skip to content

check non-callable __bool__ on in operator result#3051

Open
knQzx wants to merge 1 commit intofacebook:mainfrom
knQzx:fix-in-operator-bool-check
Open

check non-callable __bool__ on in operator result#3051
knQzx wants to merge 1 commit intofacebook:mainfrom
knQzx:fix-in-operator-bool-check

Conversation

@knQzx
Copy link
Copy Markdown
Contributor

@knQzx knQzx commented Apr 7, 2026

summary

  • in/not in operator now checks that bool is callable on the contains return type
  • also returns bool instead of the raw contains return type, matching python semantics

test plan

  • updated existing bug test case to expect the error
  • all 4678 tests pass

fixes #2913

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non-callable __bool__ in membership tests

1 participant