Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #22163; use {.push warning[BareExcept]:off.} to override settings temporarily #21390

Merged
merged 2 commits into from
Jun 27, 2023

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Feb 18, 2023

The push/pop pragmas are very similar to the option directive,
but are used to override the settings temporarily.

{.warning[BareExcept]:off.} works accidentally and might not continue to work in the future.

ref #21390 (in fact, #21390 doesn't affect semantic options like {.warning[BareExcept]:off.}, but it is misused here). In the future push pragmas will continue to work reliably => #21388

fixes #22163

@arnetheduck
Copy link
Contributor

try:..
except Exception as exc {.warning: [...].}`

and/or

{.warnig: [...].}:
  try:
  except ...

would be nice to have

@ringabout ringabout changed the title use {.push warning[BareExcept]:off.} to override settings temporarily fixes #22163; use {.push warning[BareExcept]:off.} to override settings temporarily Jun 26, 2023
@ringabout
Copy link
Member Author

I'm merging it. It should fix #22163. It's used for when warning[BareExcept] is enabled explicitly.

@github-actions
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 4ce3a68

Hint: mm: orc; opt: speed; options: -d:release
168056 lines; 11.622s; 612.219MiB peakmem

bung87 pushed a commit to bung87/Nim that referenced this pull request Jul 29, 2023
…ide settings temporarily (nim-lang#21390)

* use `{.push warning[BareExcept]:off.}` to override settings temporarily

* likewise, suppress expect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BareExcept warning is sometimes not silenceable
2 participants