You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
exceptions raised before calling task_status.started loses cause & context #3261
we currently only run the ruff reimplementation of flake8-async, which hasn't added that rule. So we should maybe consider running flake8-async as well, disabling any rules that ruff handles [better], or are noisy.
It should make use of trio._util.raise_saving_context.
repro:
importtrioasyncdeftask(task_status: trio.TaskStatus) ->None:
e=ValueError("foo")
e.__cause__=SyntaxError("bar")
e.__context__=TypeError("baz")
raiseeasyncdefmain() ->None:
asyncwithtrio.open_nursery() asnursery:
awaitnursery.start(task)
try:
trio.run(main)
exceptExceptionGroupasexcgroup:
# should be SyntaxError, is Noneprint(excgroup.exceptions[0].__cause__)
# should be TypeError, is the exceptiongroupprint(repr(excgroup.exceptions[0].__context__))
we can use the pre-commit files or exclude directives to exclude them
I was hoping to maybe be able to run it as a command, but this makes enough sense to me.
if that is a problem I would love to know so I can fix it!
Yeah for instance the tag referenced on the docs doesn't exist:
(.venv) PS C:\Users\A5rocks\Documents\trio> pre-commit run -a
[INFO] Initializing environment for https://github.com/python-trio/flake8-async.
An unexpected error has occurred: CalledProcessError: command: ('C:\\Program Files\\Git\\cmd\\git.EXE', 'checkout', '25.5.2')
return code: 1
stdout: (none)
stderr:
error: pathspec '25.5.2' did not match any file(s) known to git
Check the log at C:\Users\A5rocks\.cache\pre-commit\pre-commit.log
This isn't really a problem (we can just use old versions in pre-commit, or maybe even commit hashes?) but it's suboptimal.
Activity
A5rocks commentedon May 22, 2025
I was looking at flake8-async:
If those are bugs I can go make issues. (also generally theres a lot of errors raised...)
jakkdl commentedon May 22, 2025
we can use the pre-commit
filesorexcludedirectives to exclude themif that is a problem I would love to know so I can fix it!
A5rocks commentedon May 23, 2025
I was hoping to maybe be able to run it as a command, but this makes enough sense to me.
Yeah for instance the tag referenced on the docs doesn't exist:
This isn't really a problem (we can just use old versions in pre-commit, or maybe even commit hashes?) but it's suboptimal.
jakkdl commentedon May 23, 2025
whelp, it appears I broke git tagging in python-trio/flake8-async#321
thank you, will fix!
EDIT: fixing in python-trio/flake8-async#385
Fix exceptions raised before task_status.started() losing cause and c…
Add newsfragment for python-trio#3261
Fix exception cause/context lost before task_status.started() (python…