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.

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

115115
116116 def exit_code(self) -> int:
117117 """Return the program exit code."""
118+ if self.catastrophic_failure:
119+ return 1
118120 assert self.options is not None
119121 if self.options.exit_zero:
120- return int(self.catastrophic_failure)
122+ return 0
121123 else:
122- return int((self.result_count > 0) or self.catastrophic_failure)
124+ return int(self.result_count > 0)
123125
124126 def find_plugins(
125127 self,
391393 except exceptions.EarlyQuit:
392394 self.catastrophic_failure = True
393395 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)
398400

The check that tells the two apart

failpass·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