silence mass dump of BareExcept when using unittest (#25260)

Seems better to change it to `CatchableError` instead?

(cherry picked from commit cc4c7377b2)
This commit is contained in:
Ryan McConnell
2025-11-10 01:27:50 -05:00
committed by narimiran
parent 38384d040a
commit c75c85cbf8
2 changed files with 3 additions and 11 deletions

View File

@@ -394,8 +394,9 @@ proc semTry(c: PContext, n: PNode; flags: TExprFlags; expectedType: PType = nil)
elif a.len == 1:
# count number of ``except: body`` blocks
inc catchAllExcepts
message(c.config, a.info, warnBareExcept,
"The bare except clause is deprecated; use `except CatchableError:` instead")
if noPanicOnExcept in c.graph.config.legacyFeatures:
message(c.config, a.info, warnBareExcept,
"The bare except clause is deprecated; use `except CatchableError:` instead")
else:
# support ``except KeyError, ValueError, ... : body``
if catchAllExcepts > 0: