From e7a1bd7cde0720c52c2b88c83c64bd163c5615d7 Mon Sep 17 00:00:00 2001 From: haosenwang1018 <167664334+haosenwang1018@users.noreply.github.com> Date: Thu, 26 Feb 2026 03:08:24 +0000 Subject: [PATCH] fix: replace 5 bare except clauses with except Exception --- pycodestyle.py | 2 +- testing/data/E72.py | 6 +++--- testing/data/E90.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pycodestyle.py b/pycodestyle.py index 868e79d5..eea27fbe 100755 --- a/pycodestyle.py +++ b/pycodestyle.py @@ -1518,7 +1518,7 @@ def bare_except(logical_line, noqa): Okay: except Exception: Okay: except BaseException: - E722: except: + E722: except Exception: """ if noqa: return diff --git a/testing/data/E72.py b/testing/data/E72.py index 5d1046cb..6275e1ee 100644 --- a/testing/data/E72.py +++ b/testing/data/E72.py @@ -55,14 +55,14 @@ def func_histype(a, b, c): #: E722 try: pass -except: +except Exception: pass #: E722 try: pass except Exception: pass -except: +except Exception: pass #: E722 E203 E271 try: @@ -73,7 +73,7 @@ def func_histype(a, b, c): fake_code = """" try: do_something() -except: +except Exception: pass """ try: diff --git a/testing/data/E90.py b/testing/data/E90.py index e0a10d04..ae71817d 100644 --- a/testing/data/E90.py +++ b/testing/data/E90.py @@ -4,7 +4,7 @@ while True: try: pass - except: + except Exception: print 'Whoops' #: Okay