Commit 1006446
fbcode/cinderx/PythonLib/cinderx/compiler/pycodegen.py
Summary:
Remove 5 `pyre-fixme` suppressions in `pycodegen.py` by fixing the underlying type issues:
**`emitAugName` (1 fixme removed):** Added `assert isinstance(target, ast.Name)` to narrow the type of `node.target` from `ast.expr` to `ast.Name`. The caller `visitAugAssign` already guarantees this via an `isinstance` check before dispatching, so this makes the existing assumption explicit for Pyre.
**`emit_try_star_except` (4 fixmes removed):** Bound `handler.name` (typed `str | None`) to a local variable `handler_name` before the existing `if handler_name:` checks. Pyre was losing the `Optional` narrowing across interleaving method calls (`self.emit`, `self.storeName`). The local variable preserves the narrowing without changing control flow.
---
> Generated by [RACER](https://www.internalfb.com/wiki/RACER_(Risk-Aware_Code_Editing_and_Refactoring)/), powered by [Confucius](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/)
[Session](https://www.internalfb.com/confucius?session_id=32fb3408-21bd-11f1-b9cb-85e1b7b3e743&tab=Chat), [Trace](https://www.internalfb.com/confucius?session_id=32fb3408-21bd-11f1-b9cb-85e1b7b3e743&tab=Trace)
Reviewed By: alexmalyshev, yoney
Differential Revision: D96873199
fbshipit-source-id: 3d606bc572d8609819242f9d74bd49acb5842e941 parent 216d49b commit 1006446
1 file changed
Lines changed: 8 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1414 | 1414 | | |
1415 | 1415 | | |
1416 | 1416 | | |
1417 | | - | |
1418 | | - | |
1419 | | - | |
| 1417 | + | |
1420 | 1418 | | |
1421 | 1419 | | |
1422 | 1420 | | |
| |||
5446 | 5444 | | |
5447 | 5445 | | |
5448 | 5446 | | |
5449 | | - | |
| 5447 | + | |
| 5448 | + | |
5450 | 5449 | | |
5451 | | - | |
5452 | | - | |
5453 | | - | |
5454 | | - | |
5455 | | - | |
5456 | | - | |
| 5450 | + | |
| 5451 | + | |
5457 | 5452 | | |
5458 | 5453 | | |
5459 | 5454 | | |
5460 | 5455 | | |
5461 | | - | |
| 5456 | + | |
5462 | 5457 | | |
5463 | | - | |
5464 | | - | |
5465 | | - | |
5466 | | - | |
5467 | | - | |
5468 | | - | |
| 5458 | + | |
| 5459 | + | |
5469 | 5460 | | |
5470 | 5461 | | |
5471 | 5462 | | |
| |||
0 commit comments