| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
CC @ambv, because you was the reviewer together with @Fidget-Spinner the last time. |
Sorry, something went wrong.
There was a problem hiding this comment.
I like the idea of making get_type_hints() stricter for runtime objects, which is already the case for forward references (e.g. either string annotations or from __future__ import annotations). It's a breaking change though so it can only go in for Python 3.11.
Measuring performance impact here would be important as well.
Sorry, something went wrong.
|
Thanks a lot, @ambv! I've implemented requested changes. Sorry for the long wait, I am changing cities, so I cannot work full time on Python right now 🙂 |
Sorry, something went wrong.
How can I do that? 🤔 |
Sorry, something went wrong.
You probably have to write a small throwaway microbenchmark. Something that declares a whole bunch of annotations that happen to call _type_check() (for example, a large number of different Tuple types, defeating @_tp_cache). I'm more concerned about annotations than about get_type_hints() here. |
Sorry, something went wrong.
|
Marking as "do not merge" given the concerns from @Fidget-Spinner on the bug (which I agree with). We should do less runtime type checking in typing.py, not more. |
Sorry, something went wrong.
|
Yes, I now understand that the long-time goal is to make less runtime checks, not more 🙂 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR contains quite a lot of changes, but they are all related.
I am pretty sure that this change can cause multiple problems for people with wrong annotations, because get_type_hints() was much more forgiving before this change. But, as a heavy typing user, I believe that this is a good thing, because correctness is very important in this area.
https://bugs.python.org/issue45283