Skip to content

Commit 516dc86

Browse files
committed
chore: clearer comment and tighter error handling
1 parent 529b01d commit 516dc86

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

asyncio/core.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@
2121
# Import TaskQueue and Task, preferring built-in C code over Python code
2222
try:
2323
from _asyncio import TaskQueue, Task
24-
except:
24+
except ImportError:
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
27+
# Depending on the release of CircuitPython these errors may or may not
28+
# exist in the C implementation of `_asyncio`. However, when they
29+
# do exist, must be preferred over the Python code.
2930
try:
3031
from _asyncio import CancelledError, InvalidStateError
31-
except:
32+
except (ImportError, AttributeError):
3233
from .task import CancelledError, InvalidStateError
3334

3435
################################################################################

0 commit comments

Comments
 (0)