Closed jolaf closed 1 year ago
I'm hoping this can be narrowed down to a specific annotation.
It's not annotation, it crashes at
from ._core._fileio import AsyncFile, Path, open_file, wrap_file
Then it's some annotation in the anyio._core._fileio
module that's causing this.
Added a different crash on the same test on latest Python on Windows.
I'm not sure I now have the time to dig in other people's code.
The second one was fixed in 041b0e3f.
If I install typeguard from master, I don't see this crash, at least against the latest AnyIO.
I've just tried with the current master
, the first crash is still there.
Can it be a version of Python is important?
I tried with 3.10.12, and didn't experience the crash.
Maybe you could try to nuke your __pycache__
and try again?
I'm definitely running on master
, latest commit is 6e96b75
.
I run straight from src
directory in my working copy.
Ok, so if you create a new virtualenv and install both packages, and run your test script (named test.py
here):
python3.10 -m venv venv
venv/bin/pip install anyio git+https://github.com/agronholm/typeguard.git
venv/bin/python test.py
What happens? I get no errors.
Oh, it turned out I didn't have the latest anyio
.
On latest one there's no crash indeed.
For me, crash happens on anyio==3.6.2
.
Yes, I can reproduce it too on 3.6.2. I will investigate this. But to fix your immediate problem, can you upgrade? The problem doesn't occur on 3.7.1 either.
Thank you very much!
Yes, upgrading helps.
Found the offending annotation: Union[Iterable[ReadableBuffer], Iterable[str]]
. The first union element does it, and it has to be in a union to trigger the problem.
I have a failing unit test for this now.
Thanks!
Things to check first
[X] I have searched the existing issues and didn't find my bug already reported there
[X] I have checked that my bug is still present in the latest release
Typeguard version
4.1.3
Python version
3.10.12
What happened?
Ubuntu 22.04.3 Python 3.10.12:
Windows 10 Python 3.11.5:
How can we reproduce the bug?
test.py
: