Repository navigation
Python implicit boolean conversion in logical operations bypasses try/except on 3.14.0rc1 #137288
Copy link
Copy link
Closed
Labels
3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)release-blockertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jul 31, 2025 Confirmed on LinuxMint.
Bisects to 78aeb38 (#124394), cc @iritkatriel
Reacted by Irit Katriel- addedinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixes
on Jul 31, 2025 Thank you @justinjfu for reporting and @brianschubert for bisecting. This is a nice little bug.
Fix in #137310
- added a commit that references this issue
on Aug 1, 2025 Thank you for the quick fix!
- added a commit that references this issue
on Aug 3, 2025 7 remaining items
- added 7 commits that reference this issue
on Aug 12, 2025 - added a commit that references this issue
on Aug 12, 2025
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)release-blockertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsDone
Bug report
Bug description:
Throwing an exception during an implicit cast to a boolean as part of a logical operation (
or,and) bypasses surrounding try/except statements.The following example works on Python 3.12.3 but fails on Python 3.14.0rc1:
Example:
Output on Python 3.12.3 (expected behavior):
Output on Python 3.14.0rc1:
CPython versions tested on:
3.14
Operating systems tested on:
macOS
Linked PRs