-
greetings, I first wrote this snippet, which appears to be an incorrect way of dealing with finalization:
then I read the docs which says:
so the "correct" way to write this would be to do:
and it indeed prints however, it appears that the incorrect way of dealing with an await inside the exception deletes the database entry and doesnt print from the docs description I would have expected the delete NOT to be performed, so is there some part of the puzzle I'm missing here ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 17 replies
-
It all depends on what exactly |
Beta Was this translation helpful? Give feedback.
-
Could you please edit your question to fix the broken indent on the |
Beta Was this translation helpful? Give feedback.
It all depends on what exactly
conn.execute()
does. It may or may not work, but gist is that ifCancelledError
was raised by an AnyIO cancel scope, then it will attempt to cancel the task over and over again until thatCancelledError
reaches the cancel scope that initiated the cancellation process.