| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -2042,8 +2042,17 @@ class Leaf: | |
| class Other(Leaf): # Error reported by type checker | ||
| ... | ||
|
|
||
| There is no runtime checking of these properties. | ||
| There is no runtime checking of these properties. The decorator | ||
| sets the ``__final__`` attribute to ``True`` on the decorated object | ||
| to allow runtime introspection. | ||
| """ | ||
| try: | ||
| f.__final__ = True | ||
| except (AttributeError, TypeError): | ||
|
Comment thread
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI'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.
Sorry, something went wrong.
All reactions
|
||
| # Skip the attribute silently if it is not writable. | ||
| # AttributeError happens if the object has __slots__ or a | ||
| # read-only property, TypeError if it's a builtin class. | ||
| pass | ||
| return f | ||
|
|
||
|
|
||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| The ``@typing.final`` decorator now sets the ``__final__`` attribute on the | ||
| decorated object to allow runtime introspection. Patch by Jelle Zijlstra. |
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.