File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed
Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 2424except :
2525 from .task import TaskQueue , Task
2626
27+ # Depending on the version of CircuitPython, these errors may exist in the build-in C code
28+ # even if _asyncio exists
29+ try :
30+ from _asyncio import CancelledError , InvalidStateError
31+ except :
32+ from .task import CancelledError , InvalidStateError
2733
2834################################################################################
2935# Exceptions
3036
3137
32- class CancelledError (BaseException ):
33- """Injected into a task when calling `Task.cancel()`"""
34-
35- pass
36-
37-
3838class TimeoutError (Exception ):
3939 """Raised when waiting for a task longer than the specified timeout."""
4040
Original file line number Diff line number Diff line change 2121from . import core
2222
2323
24+ class CancelledError (BaseException ):
25+ """Injected into a task when calling `Task.cancel()`"""
26+
27+ pass
28+
29+
30+ class InvalidStateError (Exception ):
31+ """Can be raised in situations like setting a result value for a task object that already has a result value set."""
32+
33+ pass
34+
35+
2436# pairing-heap meld of 2 heaps; O(1)
2537def ph_meld (h1 , h2 ):
2638 if h1 is None :
You can’t perform that action at this time.
0 commit comments