Commit 4a26170b authored by Dong-hee Na's avatar Dong-hee Na

fix issue #596 'slice is not subclassable'

fix issue #596 'slice is not subclassable'
parent 92666536
...@@ -4018,6 +4018,7 @@ void setupRuntime() { ...@@ -4018,6 +4018,7 @@ void setupRuntime() {
slice_cls->giveAttr("step", new BoxedMemberDescriptor(BoxedMemberDescriptor::OBJECT, offsetof(BoxedSlice, step))); slice_cls->giveAttr("step", new BoxedMemberDescriptor(BoxedMemberDescriptor::OBJECT, offsetof(BoxedSlice, step)));
slice_cls->freeze(); slice_cls->freeze();
slice_cls->tp_compare = (cmpfunc)slice_compare; slice_cls->tp_compare = (cmpfunc)slice_compare;
slice_cls->tp_flags &= ~Py_TPFLAGS_BASETYPE;
static PyMappingMethods attrwrapper_as_mapping; static PyMappingMethods attrwrapper_as_mapping;
attrwrapper_cls->tp_as_mapping = &attrwrapper_as_mapping; attrwrapper_cls->tp_as_mapping = &attrwrapper_as_mapping;
......
# should_error
class foo(slice):
pass
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment