summary refs log tree commit diff stats
path: root/lib/std
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-06-27 08:03:52 +0800
committerGitHub <noreply@github.com>2023-06-27 08:03:52 +0800
commit4ce3a68e794fe3d448928ccbbc34191ce24c4fbd (patch)
treecc7e84158516c424ea6f80fa773f891f15078a78 /lib/std
parent4546f5dfe539ff4f37a5100bdfedaf4867293f3a (diff)
downloadNim-4ce3a68e794fe3d448928ccbbc34191ce24c4fbd.tar.gz
fixes #22163; use `{.push warning[BareExcept]:off.}` to override settings temporarily (#21390)
* use `{.push warning[BareExcept]:off.}` to override settings temporarily

* likewise, suppress expect
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/assertions.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/assertions.nim b/lib/std/assertions.nim
index 3dca644ad..56c37d205 100644
--- a/lib/std/assertions.nim
+++ b/lib/std/assertions.nim
@@ -98,7 +98,7 @@ template doAssertRaises*(exception: typedesc, code: untyped) =
   const begin = "expected raising '" & astToStr(exception) & "', instead"
   const msgEnd = " by: " & astToStr(code)
   template raisedForeign {.gensym.} = raiseAssert(begin & " raised foreign exception" & msgEnd)
-  {.warning[BareExcept]:off.}
+  {.push warning[BareExcept]:off.}
   when Exception is exception:
     try:
       if true:
@@ -117,6 +117,6 @@ template doAssertRaises*(exception: typedesc, code: untyped) =
       mixin `$` # alternatively, we could define $cstring in this module
       raiseAssert(begin & " raised '" & $e.name & "'" & msgEnd)
     except: raisedForeign()
-  {.warning[BareExcept]:on.}
+  {.pop.}
   if wrong:
     raiseAssert(begin & " nothing was raised" & msgEnd)