Skip to content

Conversation

@chbndrhnns
Copy link
Contributor

@chbndrhnns chbndrhnns commented Dec 15, 2025

Would you consider such a hacky way to look into callees?

Fixes https://youtrack.jetbrains.com/issue/PY-72253/False-positive-Local-variable-x-might-be-referenced-before-assignment-after-try-except-block-when-a-function-call-in-except


Note

When a call target lacks a never-return annotation, analyze the callee’s control-flow to treat calls as no-return if the function’s exit is unreachable, with caching and limits; adds a test for a raising callee.

  • Control flow analysis
    • Update CallInstruction.kt to detect no-return calls by inspecting callee CFG when no explicit return type is provided.
    • Add cached functionIsEffectivelyNoReturn and DFS-based exitIsReachable with safety limits to avoid large/complex graphs.
  • Tests
    • Add ControlFlowIsAbruptAfterRaisingCallee.py/.txt test data.
    • Register testControlFlowIsAbruptAfterRaisingCallee in PyControlFlowBuilderTest.java.

Written by Cursor Bugbot for commit a4ceedd. This will update automatically on new commits. Configure here.

@lancelote lancelote requested a review from KalininDL December 15, 2025 22:40
@BartvHelvert BartvHelvert added the PyCharm Pull requests for PyCharm label Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PyCharm Pull requests for PyCharm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants