with_metaclass: check existence of `__prepare__` attribute before calling it
behnam opened this issue · 1 comments
behnam commented
plugin-python/vendor/python/six.py
Line 831 in 04dc40a
The def with_metaclass()
implementation assumes that all meta classes have __prepare__
defined.
The Python Reference says (https://docs.python.org/3/reference/datamodel.html#preparing-the-class-namespace):
If the metaclass has a
__prepare__
attribute, it is called as [...].If the metaclass has no
__prepare__
attribute, then the class namespace is initialised as an empty ordered mapping.
Therefore, I think six
should check existence of __prepare__
attribute before calling it, as __prepare__
is not defined on type
in PY2.
behnam commented
Oops, wrong repo. It's here: benjaminp/six#252