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

all builtin types are subclassable, even when they shouldn't be #596

Closed
toshok opened this issue Jun 9, 2015 · 2 comments
Closed

all builtin types are subclassable, even when they shouldn't be #596

toshok opened this issue Jun 9, 2015 · 2 comments

Comments

@toshok
Copy link
Contributor

toshok commented Jun 9, 2015

the following example:

class foo(slice):
    pass

succeeds in pyston and raises in cpython:

TypeError: Error when calling the metaclass bases
    type 'slice' is not an acceptable base type

this is due to the fact that Py_TPFLAGS_BASETYPE is or'ed into the tp_flags of all BoxedClasses. we need a way to either keep that from happening or override it after BoxedClass creation time. we also need to audit our builtins to make sure only the proper ones are subclassable.

undingen added a commit that referenced this issue Jan 4, 2016
Fix issue #596 'slice is not subclassable'
@undingen
Copy link
Contributor

while slice is now fixed there are still some types left:
e.g:

class C(type(xrange(1))): pass

@undingen
Copy link
Contributor

undingen commented Feb 9, 2016

fixed in #1061

@undingen undingen closed this as completed Feb 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants