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

add {.push raises: [].} to more files #5943

Merged
merged 8 commits into from
Feb 22, 2024
Merged

Conversation

etan-status
Copy link
Contributor

Extend {.push raises: [].} to all files with spec references that are periodically updated.

Extend `{.push raises: [].}` to all files with spec references that are
periodically updated.

- #5942
@@ -5,6 +5,8 @@
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.push raises: [].}
Copy link
Contributor

@tersec tersec Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didn't work for me in this file -- I reverted the automated changes, since the point of the automated PR in fixtures_utils.nim is to be risk-free and to literally nothing interesting semantically. Adding some {.push raises: [].} is okay, but changing the content to support them isn't, for that PR.

Also, the linter error message shows {.push raises: []}. I'm not sure if that works too, but it's not consistent with what the codebase is using.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, extracted the addition of the {.push raises: [].} to here so that the other PR can remain as a purely automated change.

@@ -5,6 +5,7 @@
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.push raises: [].}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nimbus-eth2/tests/consensus_spec/test_fixture_kzg.nim(39, 48) Error: relativePath(path, suitePath, '/') can raise an unlisted exception: Exception

also reverted this from the automated PR for similar reasons -- easy or hard to fix, doesn't matter. It's a semantic change and that PR should have exactly zero semantic changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That particular exception seems strange to me, but I spent no time investigating it at all yet. If nothing else, relativePath wasn't/isn't core functionality and there are definitely other ways of achieving the same thing; it was just slightly more convenient at the time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relativePath raises when the arguments are not referring to paths. Had the same in fork choice test suite and extracted it to a reusable helper.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also

{.push raises: [].}
raise newException(ValueError, "")

compiles and, predictably, raises.

I guess {.push raises: [].} only works in procs/funcs or maybe templates or iterators. My current working model is, maybe it needs something to attach to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, notably, it also fails for {.async.}. it's a best-effort thing, not exhaustive for sure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, async is a custom pragma implemented by a non-stdlib thing in Chronos's case which just transforms the incoming function arbitrarily. Hard to pin that on Nim necessarily. This isn't.

@tersec
Copy link
Contributor

tersec commented Feb 21, 2024

#5942 has merged and covers of the more trivial parts of this -- at least, could ensure that it's not going to insert duplicate {.push raises: [].}

Copy link

github-actions bot commented Feb 21, 2024

Unit Test Results

         9 files    1 107 suites   23m 56s ⏱️
  4 233 tests   3 886 ✔️ 347 💤 0
16 894 runs  16 496 ✔️ 398 💤 0

Results for commit ec65d2f.

♻️ This comment has been updated with latest results.

@etan-status etan-status merged commit 702f4c6 into unstable Feb 22, 2024
13 checks passed
@etan-status etan-status deleted the dev/etan/nm-raisesspec branch February 22, 2024 10:03
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.

2 participants