-
Notifications
You must be signed in to change notification settings - Fork 826
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
CancelledError
when doing a self.remove
from a timer (in Python 3.7 but not Python 3.11)
#2854
Comments
See Textualize#2854 -- turns out that it's still an issue, but on Python 3.7 but not Python 3.11 (as mentioned in the linked issue, I've not tested other versions yet).
Weird one! |
I managed to reproduce the issue in Python 3.7. Waiting for resolution of #2883 as that may mean there is nothing to do here. |
We won't be dropping 3.7 any time soon, so we may need a workaround. I'm guessing we need to wrap that wait and catch Cancelled Errors. You might want to look at the implementation of locks.py in 3.8 and above. |
Don't forget to star the repository! Follow @textualizeio for Textual updates. |
Having run into this while working on notifications, and puzzled over this with @willmcgugan when first seen, this is me isolating the problem into its own code/issue for further investigation.
For anyone looking at this, I've already uncovered what might be one really important bit of information: THIS DEPENDS ON PYTHON VERSION. I get the error I'm about to describe when working with Python 3.7, but not with Python 3.11 (I've yet to test 3.8, 3.9 or 3.10).
Given this code:
with Python 3.7 and the latest Textual, if you mash the button and wait for a moment for a
Label
to remove itself, you'll get the following error:If
SelfRemovingLabel
is modified to add a level of indirection to the remove, for example:it works fine.
The text was updated successfully, but these errors were encountered: