-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Replace builtins.function with types.FunctionType #3171
Comments
The main reason for removing |
|
Closing as a duplicate of #3171 (it's a newer issue, but discusses the topic in a more general fashion, which is useful) |
@AlexWaygood this is #3171 :) |
Thanks, I meant #8240 lol |
Copied from #3107
It seems that with this change, every test needs types.FunctionType in the test stubs (probably because builtins.function was used as a fallback). And that means builtins.pyi (and every custom bultins fixture) would have to import types. (On top of that, we'll also need to define list everywhere since types.pyi uses it.)
Do we want to do some workaround, like manually inject types.FunctionType into the test environment, without importing types? Not that types.pyi is huge, but it does have a generic in it.
@ilevkivskyi
There's an issue with importing
types
module everywhere; it breaks a lot of tests due to the presence ofTypeVar
in it, and therefore the requirement to bring intyping
as well. In particular, it breaks incremental tests, tests that use[file builtins.py]
(even after I addedimport types
to all fixtures). Also fixingThirdPass.builtin_type
to make it work fortypes.FunctionType
would be quite hacky.I am now thinking that maybe we should not replace all
builtins.function
after all. If we want the user to be able to usetypes.FunctionType
, that's ok, but perhaps internally it's not worth changing?The text was updated successfully, but these errors were encountered: