bpo-46342: make @typing.final introspectable#30530
Conversation
| """ | ||
| try: | ||
| f.__final__ = True | ||
| except (AttributeError, TypeError): |
There was a problem hiding this comment.
I'd be open to just doing just except Exception here, in case some type throws a different exception if you try to set an attribute. For precedent, note that @no_type_check catches only TypeError.
|
LGTM. |
|
quora/pyanalyze#161. My type checker, pyanalyze, imports modules it typechecks and uses the runtime objects for checking. With this change, I can make it show an error if you inherit from something |
Misc/NEWS.d/next/Library/2022-01-11-04-28-09.bpo-46342.5QVEH1.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Ken Jin <[email protected]>
Co-authored-by: Ken Jin <[email protected]>
gvanrossum
left a comment
There was a problem hiding this comment.
Sounds like a good idea. I trust the current participants to come up with the right thing. Let me know when you all agree and you want me to merge it.
https://bugs.python.org/issue46342