-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asynchronous sessionmaker initialization type error #155
Comments
Thanks for the report |
Same happening for me. |
released as v0.0.2a10 |
This appears to have regressed? I'm using version 0.0.2a27, and the example in this issue now produces:
when using Pyright. I noticed that almost the same error message appears when using
|
@mjpieters I am hoping 2.0 betas are very soon. that's where these issues if you have them will be permanently fixed so i hope you have time to test a bit. |
Yeah, I can't find a release of sqlalchemy2-stubs that actually makes the example work, so it's probably a pyright incompatibility somewhere. |
If you want to send a PR to fix things until v2 is out we can merge and release fairly quickly |
I traced this down to pyright not accepting that
The issue could trivially be fixed if PEP 673 However, I think I can at least make this fail for mypy as well with:
This is an update to a single
|
Right, so the simplest fix is to not use bound typevars for methods producing a contextmanager; for both def no_autoflush(self: _M) -> ContextManager[_M]: ... It's essentially the same meaning; whatever I was, however, wrong about my assessment that I could make mypy fail on the same issue; the error it produces when you use the |
I've traced this to a Pyright issue with |
Thanks for debugging this. If you could provide a PR with the fix it would be great! |
It's an acknowledged pyright bug; it's in their court. The type definition is correct, the type checker is not, so no PR needed! |
oh ok, good to know! thanks for looking into it! We can close then! |
Describe the bug
mypy fails on asynchronous sessionmaker initialization.
Expected behavior
No errors.
To Reproduce
Please try to provide a Minimal, Complete, and Verifiable example.
See also Reporting Bugs on the website, and some example issues.
Please do not use Flask-SQLAlchemy or any other third-party extensions or dependencies in test cases. The test case must illustrate the problem without using any third party SQLAlchemy extensions. Otherwise, please report the bug to those projects first.
Error
Versions.
Additional context
The problem appeared on the latest release of sqlalchemy2-stubs and was not present on v0.0.2a8.
Have a nice day!
The text was updated successfully, but these errors were encountered: