Opened 8 years ago
Closed 8 years ago
#18503 closed defect (fixed)
cdef'ed metaclasses don't work with six's with_metaclass
Reported by: | jpswanson | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-6.8 |
Component: | misc | Keywords: | ClasscallMetaclass, six, with_metaclass, metaclass, python3, days64.25 |
Cc: | ohanar | Merged in: | |
Authors: | R. Andrew Ohana | Reviewers: | Josh Swanson |
Report Upstream: | N/A | Work issues: | |
Branch: | 7486057 (Commits, GitHub, GitLab) | Commit: | 7486057408c3e3d74027c46bb6e87a9522c288ad |
Dependencies: | Stopgaps: |
Description
Title says it all. MWE:
from sage.misc.classcall_metaclass import ClasscallMetaclass from six import with_metaclass class foo(with_metaclass(ClasscallMetaclass)): pass
throws an error
TypeError: type.__new__(metaclass) is not safe, use sage.misc.classcall_metaclass.ClasscallMetaclass.__new__()
in six.pyc in with_metaclass(meta, *bases). If mixed Python 2 and Python 3 becomes a reality (e.g. #18492), this'll need to be fixed.
Change History (5)
comment:1 Changed 8 years ago by
Cc: | ohanar added |
---|
comment:2 Changed 8 years ago by
Authors: | Josh Swanson → R. Andrew Ohana |
---|---|
Branch: | → u/ohanar/with_metaclass |
Commit: | → 7486057408c3e3d74027c46bb6e87a9522c288ad |
Status: | new → needs_review |
Summary: | ClasscallMetaclass doesn't work with six's with_metaclass → cdef'ed metaclasses don't work with six's with_metaclass |
comment:3 Changed 8 years ago by
Reviewers: | → Josh Swanson |
---|---|
Status: | needs_review → positive_review |
Good enough. It's a bit infortunate to have to add a slightly modified version of six to Sage, but we might run into other Cython-specific issues with it and development on six seems to have stopped for the last year or so.
comment:4 Changed 8 years ago by
Keywords: | days64.25 added |
---|
comment:5 Changed 8 years ago by
Branch: | u/ohanar/with_metaclass → 7486057408c3e3d74027c46bb6e87a9522c288ad |
---|---|
Resolution: | → fixed |
Status: | positive_review → closed |
Note: See
TracTickets for help on using
tickets.
New commits:
add a with_metaclass that works with cdef'ed classes