[Python-checkins] Fix __init_subclass__ using self instead of class (#31135)

gvanrossum webhook-mailer at python.org
Sat Feb 5 10:50:11 EST 2022


https://github.com/python/cpython/commit/2f077b6991f59c51989b65618317297c1eb0fb95
commit: 2f077b6991f59c51989b65618317297c1eb0fb95
branch: main
author: Gregory Beauregard <greg at greg.red>
committer: gvanrossum <gvanrossum at gmail.com>
date: 2022-02-05T07:50:00-08:00
summary:

Fix __init_subclass__ using self instead of class (#31135)

files:
M Lib/typing.py

diff --git a/Lib/typing.py b/Lib/typing.py
index 0cf9755022e9b..e4e32b5b320d0 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -349,7 +349,7 @@ class _Final:
 
     __slots__ = ('__weakref__',)
 
-    def __init_subclass__(self, /, *args, **kwds):
+    def __init_subclass__(cls, /, *args, **kwds):
         if '_root' not in kwds:
             raise TypeError("Cannot subclass special typing classes")
 



More information about the Python-checkins mailing list