-
Notifications
You must be signed in to change notification settings - Fork 13
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
Nim 2.0 fixes #23
base: master
Are you sure you want to change the base?
Nim 2.0 fixes #23
Conversation
src/tiny_sqlite.nim
Outdated
finally: | ||
if ok: | ||
db.exec("COMMIT") | ||
db.exec(if ok: "COMMIT" else: "ROLLBACK") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is why the tests are failing. The body
is allowed to contain a return
, break
, or similar so ok = true
might not execute. That the old code is no longer valid seems like an oversight in Nims exception tracking since a bare raise
statement cannot raise anything that couldn't already be raised by the code in the try
block :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right! I reverted this change, but had to add more stuff so that compiler would not mark every execMany/execScript call as possibly raising an Exception
. Now the tests are passing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then I thought if we could understand in the finally
block whether an exception is being raised, then we would not have to mess with except/raise; and so it seems, getCurrentException() can be used. So the last version is much simpler.
…xplicitly to pacify Nim exception tracking
Ok, here is finally what I had in mind ;) |
These changes make the code compile and work with Nim 2.0rc1.