Skip to content

check non-callable __bool__ in assert statements#3050

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

check non-callable __bool__ in assert statements#3050
knQzx wants to merge 1 commit intofacebook:mainfrom
knQzx:fix-assert-bool-check

Conversation

@knQzx
Copy link
Copy Markdown
Contributor

@knQzx knQzx commented Apr 7, 2026

summary

  • assert statements now check that bool is callable on the test expression
  • previously only if/while/ternary checked this, assert was missing the check
  • matches behavior of pyright and mypy which flag this

test plan

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

fixes #2914

@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__ attribute

1 participant