Whole file
pycqa/flake8
The author described this change as “fix AttributeError when catatstrophic failure is triggered”. It counts as a record because the check below fails on the code as it stood at f7a86ca04 and passes on a7be5e798, with nothing else changed between the two runs.
Projectpycqa/flake8
Fix saved2021-12-24
Sharing licenceMIT · LICENSE
Change size+8 −6
What the code was meant to do, written into the code itself as a save note
fix AttributeError when catatstrophic failure is triggered
The change
| 115 | 115 | ||
| 116 | 116 | def exit_code(self) -> int: | |
| 117 | 117 | """Return the program exit code.""" | |
| 118 | + | if self.catastrophic_failure: | |
| 119 | + | return 1 | |
| 118 | 120 | assert self.options is not None | |
| 119 | 121 | if self.options.exit_zero: | |
| 120 | - | return int(self.catastrophic_failure) | |
| 122 | + | return 0 | |
| 121 | 123 | else: | |
| 122 | - | return int((self.result_count > 0) or self.catastrophic_failure) | |
| 124 | + | return int(self.result_count > 0) | |
| 123 | 125 | ||
| 124 | 126 | def find_plugins( | |
| 125 | 127 | self, | |
| ⋯ | |||
| 391 | 393 | except exceptions.EarlyQuit: | |
| 392 | 394 | self.catastrophic_failure = True | |
| 393 | 395 | print("... stopped while processing files") | |
| 394 | - | ||
| 395 | - | assert self.options is not None | |
| 396 | - | if self.options.count: | |
| 397 | - | print(self.result_count) | |
| 396 | + | else: | |
| 397 | + | assert self.options is not None | |
| 398 | + | if self.options.count: | |
| 399 | + | print(self.result_count) | |
| 398 | 400 | ||
The check that tells the two apart
fail→pass·tests/integration/test_main.py::test_early_keyboard_interrupt_does_not_crash
Check file tests/integration/test_main.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before itf7a86ca04b57b8a3bb71549d41ffc560ad5ce482
Broken version dated2021-12-20
Moduleflake8.main.application
Units changedApplication
Fingerprint98301b27700df92e
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in pycqa/flake8
- 2022-11-08load_config
- 2017-07-28Remediate one wafer thing decision logic bug
- 2016-02-20Notifier
- 2015-12-29Fix logic for Notifier.listeners_for