Skip to content
New issue

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

metaclass conflict error on Python 2.7.12 #19

Closed
TheProdigyFilippo opened this issue Nov 7, 2017 · 2 comments · Fixed by #20
Closed

metaclass conflict error on Python 2.7.12 #19

TheProdigyFilippo opened this issue Nov 7, 2017 · 2 comments · Fixed by #20

Comments

@TheProdigyFilippo
Copy link

When running
from dj.choices import Choices

exception occurs:

...
return type.new(meta, classname, bases, classDict)
TypeError: Error when calling the metaclass bases
metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

It is caused by using __metaclass__ in line 245 in __init__.py:

class Choices(six.with_metaclass(_ChoicesMeta, list)):                          
    __metaclass__ = _ChoicesMeta

Probably __metaclass__ is not needed when six.with_metaclass is used. Deleting __metaclass__ fixes the error

@mkurek
Copy link
Collaborator

mkurek commented Nov 7, 2017

Hi @TheProdigyFilippo - this behaviour has changed in six 1.11.0 (probably because of benjaminp/six#191), so if you want you can freeze six version at 1.10.0 or make PR to dj.choices with removing __metaclass__ property.

@konr4d
Copy link

konr4d commented Oct 12, 2019

@ambv This is a valid fix. (benjaminp/six#210) Could you please accept the pull request to avoid unnecessary forks?

@ambv ambv closed this as completed in #20 Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants