-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Type of open() changes if plugin overrides get_function_hook #8331
Comments
open
changes if plugin overrides get_function_hook
This is part of how plugins work, only one plugin hook is called if there are multiple registered plugins. This is why we have this two-step logic: |
Hm, I see. The |
There is some (very) limited API that you can use to make a bit deeper inspection than just |
When plugin overrides get_function_hook, the type of
open
function changes fromtyping.TextIO
totyping.IO[Any]
.Consider this trivial plugin (type annotations stripped for brevity):
With this plugin enabled,
reveal_type(open('str'))
produces message:note: Revealed type is 'typing.IO[Any]'
. Without plugin the type istyping.TextIO
.The issue was reported to mypy-zope pligin: Shoobx/mypy-zope#16.
The text was updated successfully, but these errors were encountered: