Merge pull request #18738 from github/tausbn/python-fix-match-pruning-logic

Python: Don't prune any `MatchLiteralPattern`s
This commit is contained in:
yoff
2025-03-12 20:01:26 +01:00
committed by GitHub
3 changed files with 8 additions and 6 deletions

View File

@@ -0,0 +1,5 @@
---
category: fix
---
- `MatchLiteralPattern`s such as `case None: ...` are now never pruned from the extracted source code. This fixes some situations where code was wrongly identified as unreachable.

View File

@@ -4,6 +4,3 @@
| test.py:21:5:21:38 | For | This statement is unreachable. |
| test.py:28:9:28:21 | ExprStmt | This statement is unreachable. |
| test.py:84:5:84:21 | ExceptStmt | This statement is unreachable. |
| test.py:158:9:159:16 | Case | This statement is unreachable. |
| test.py:162:13:162:16 | Pass | This statement is unreachable. |
| test.py:167:13:167:16 | Pass | This statement is unreachable. |