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:

Status badges


Title says it all. MWE:

from sage.misc.classcall_metaclass import ClasscallMetaclass
from six import with_metaclass
class foo(with_metaclass(ClasscallMetaclass)):

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 jpswanson

Cc: ohanar added

comment:2 Changed 8 years ago by ohanar

Authors: Josh SwansonR. Andrew Ohana
Branch: u/ohanar/with_metaclass
Commit: 7486057408c3e3d74027c46bb6e87a9522c288ad
Status: newneeds_review
Summary: ClasscallMetaclass doesn't work with six's with_metaclasscdef'ed metaclasses don't work with six's with_metaclass

New commits:

7486057add a with_metaclass that works with cdef'ed classes

comment:3 Changed 8 years ago by jpswanson

Reviewers: Josh Swanson
Status: needs_reviewpositive_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 jpswanson

Keywords: days64.25 added

comment:5 Changed 8 years ago by vbraun

Branch: u/ohanar/with_metaclass7486057408c3e3d74027c46bb6e87a9522c288ad
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.