Issue 46342: Make @final introspectable at runtime (original) (raw)

Issue46342

Created on 2022-01-11 12:10 by JelleZijlstra, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 30530 merged JelleZijlstra,2022-01-11 12:34
Messages (2)
msg410298 - (view) Author: Jelle Zijlstra (JelleZijlstra) * (Python committer) Date: 2022-01-11 12:10
Currently, @typing.final is implemented as an identity function, which makes it impossible for type checkers that look at runtime objects to support it. I propose that we implement it as something like: def final(f): try: f.__final__ = True except AttributeError: pass # in case it is used on an object that doesn't support setting attributes return f I will submit a PR implementing this idea.
msg410424 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2022-01-12 19:38
New changeset 0bbf30e2b910bc9c5899134ae9d73a8df968da35 by Jelle Zijlstra in branch 'main': bpo-46342: make @typing.final introspectable (GH-30530) https://github.com/python/cpython/commit/0bbf30e2b910bc9c5899134ae9d73a8df968da35
History
Date User Action Args
2022-04-11 14:59:54 admin set github: 90500
2022-01-12 22:05:14 AlexWaygood set status: open -> closedresolution: fixedstage: patch review -> resolved
2022-01-12 19:38:33 gvanrossum set messages: +
2022-01-11 12:42:24 AlexWaygood set nosy: + AlexWaygood
2022-01-11 12:34:10 JelleZijlstra set keywords: + patchstage: needs patch -> patch reviewpull_requests: + <pull%5Frequest28732>
2022-01-11 12:10:25 JelleZijlstra create