Replace bare excepts with except BaseException

Mostly I wanted to remove uses of `noqa`.

In Python 3 the two are the same.
This commit is contained in:
Ran Benita
2020-04-24 22:15:45 +03:00
parent d1534181c0
commit 59a12e9ab3
6 changed files with 9 additions and 9 deletions

View File

@@ -277,7 +277,7 @@ class TracebackEntry:
line = str(self.statement).lstrip()
except KeyboardInterrupt:
raise
except: # noqa
except BaseException:
line = "???"
return " File %r:%d in %s\n %s\n" % (fn, self.lineno + 1, name, line)
@@ -667,12 +667,12 @@ class FormattedExcinfo:
s = str(source.getstatement(len(source) - 1))
except KeyboardInterrupt:
raise
except: # noqa
except BaseException:
try:
s = str(source[-1])
except KeyboardInterrupt:
raise
except: # noqa
except BaseException:
return 0
return 4 + (len(s) - len(s.lstrip()))