summaryrefslogtreecommitdiffstats
path: root/Lib/abc.py
diff options
context:
space:
mode:
authorNate <nate@so8r.es>2017-03-15 18:39:22 (GMT)
committerƁukasz Langa <lukasz@langa.pl>2017-03-15 18:39:22 (GMT)
commitbd583ef9857d99f9145ad0bb2c4424cc0baa63fc (patch)
treefd78d76afee6b79a286183628d2074978b3a8ad8 /Lib/abc.py
parentb4e9087e7b77e8f76feac76f9c1ab21b49c0c766 (diff)
downloadcpython-bd583ef9857d99f9145ad0bb2c4424cc0baa63fc.zip
cpython-bd583ef9857d99f9145ad0bb2c4424cc0baa63fc.tar.gz
cpython-bd583ef9857d99f9145ad0bb2c4424cc0baa63fc.tar.bz2
bpo-29581: Make ABCMeta.__new__ pass **kwargs to type.__new__ (#527)
Many metaclasses in the standard library don't play nice with __init_subclass__. This bug makes ABCMeta in particular with __init_subclass__, which is an 80/20 solution for me personally. AFAICT, a general solution to this problem requires updating all metaclasses in the standard library to make sure they pass **kwargs to type.__new__, whereas this PR only fixes ABCMeta. For context, see https://bugs.python.org/issue29581. * added a test combining ABCMeta and __init_subclass__ * Added NEWS item
Diffstat (limited to 'Lib/abc.py')
-rw-r--r--Lib/abc.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/abc.py b/Lib/abc.py
index 1cbf96a..43a34a0 100644
--- a/Lib/abc.py
+++ b/Lib/abc.py
@@ -129,8 +129,8 @@ class ABCMeta(type):
# external code.
_abc_invalidation_counter = 0
- def __new__(mcls, name, bases, namespace):
- cls = super().__new__(mcls, name, bases, namespace)
+ def __new__(mcls, name, bases, namespace, **kwargs):
+ cls = super().__new__(mcls, name, bases, namespace, **kwargs)
# Compute set of abstract method names
abstracts = {name
for name, value in namespace.items()