Commit 6a6d74fc authored by sizeoftank's avatar sizeoftank

add tp_as_mapping slots for str & tuple.

parent 34d5d939
......@@ -2987,6 +2987,9 @@ void setupStr() {
str_cls->tp_as_sequence->sq_repeat = (ssizeargfunc)string_repeat;
str_cls->tp_as_sequence->sq_slice = str_slice;
str_cls->tp_as_mapping->mp_length = (lenfunc)str_length;
str_cls->tp_as_mapping->mp_subscript = (binaryfunc)strGetitem<CAPI>;
str_cls->tp_new = (newfunc)strNewPacked;
basestring_cls->giveAttr("__doc__",
......
......@@ -811,6 +811,9 @@ void setupTuple() {
tuple_cls->tp_as_sequence->sq_contains = (objobjproc)tuplecontains;
tuple_cls->tp_iter = tupleIter;
tuple_cls->tp_as_mapping->mp_length = (lenfunc)tuplelength;
tuple_cls->tp_as_mapping->mp_subscript = (binaryfunc)tupleGetitem<CAPI>;
FunctionMetadata* hasnext = FunctionMetadata::create((void*)tupleiterHasnextUnboxed, BOOL, 1);
hasnext->addVersion((void*)tupleiterHasnext, BOXED_BOOL);
tuple_iterator_cls->giveAttr("__hasnext__", new BoxedFunction(hasnext));
......
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