ASYNC103 for sync functions
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
Research direction
Start by reproducing ASYNC103 against the sync call shown in src/trio/_core/_instrumentation.py and inspect how the rule distinguishes synchronous and asynchronous functions. Done means the false positive is no longer reported while the intended ASYNC103 cases still are; add or update the relevant regression test once its location is identified.
Written by the indexing model from the issue text.
Description
I don't think sync functions can raise trio.Cancelled, but this is causing ASYNC103:
def call(
self,
hookname: str,
*args: object,
) -> None:
# snip
for instrument in list(self.data[hookname]):
try:
getattr(instrument, hookname)(*args)
except BaseException: # E
self.remove_instrument(instrument)
INSTRUMENT_LOGGER.exception(
"Exception raised when calling %r on instrument %r. "
"Instrument has been disabled.",
hookname,
instrument,
)
Error message:
src/trio/_core/_instrumentation.py:110:20: ASYNC103 BaseException block with a code path that doesn't re-raise the error. Consider adding an `except trio.Cancelled: raise` before this exception handler.
- Dominant language
- Python
- Stars
- 26
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python-trio/flake8-async
-
rule improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
python-trio/flake8-async#457 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
python-trio/flake8-async#475 · 1 comment ·
-
new rule
Difficulty 3/5 1-2 days Newbie friendliness 55/100
python-trio/flake8-async#454 · 1 comment ·
-
good first issue
Difficulty 5/5 Over a week Newbie friendliness 15/100
python-trio/flake8-async#396 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
python-trio/flake8-async#395 · 8 comments ·
All issues in python-trio/flake8-async
Similar issues
-
bug confirmed issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
open-webui/open-webui#30750 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 90/100