micropython/py
Damien George 5e34a113ea py/runtime: Add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN.
Before this patch MP_BINARY_OP_IN had two meanings: coming from bytecode it
meant that the args needed to be swapped, but coming from within the
runtime meant that the args were already in the correct order.  This lead
to some confusion in the code and comments stating how args were reversed.
It also lead to 2 bugs: 1) containment for a subclass of a native type
didn't work; 2) the expression "{True} in True" would illegally succeed and
return True.  In both of these cases it was because the args to
MP_BINARY_OP_IN ended up being reversed twice.

To fix these things this patch introduces MP_BINARY_OP_CONTAINS which
corresponds exactly to the __contains__ special method, and this is the
operator that built-in types should implement.  MP_BINARY_OP_IN is now only
emitted by the compiler and is converted to MP_BINARY_OP_CONTAINS by
swapping the arguments.
2017-11-24 14:48:23 +11:00
..
argcheck.c py/argcheck: Remove #if guard around terse error message helper func. 2017-10-19 18:57:26 +11:00
asmarm.c
asmarm.h py/emitnative: Clean up asm macro names so they have dest as first arg. 2017-11-15 11:46:49 +11:00
asmbase.c
asmbase.h
asmthumb.c
asmthumb.h py/emitnative: Clean up asm macro names so they have dest as first arg. 2017-11-15 11:46:49 +11:00
asmx64.c
asmx64.h py/emitnative: Clean up asm macro names so they have dest as first arg. 2017-11-15 11:46:49 +11:00
asmx86.c
asmx86.h py/emitnative: Clean up asm macro names so they have dest as first arg. 2017-11-15 11:46:49 +11:00
asmxtensa.c
asmxtensa.h py/emitnative: Clean up asm macro names so they have dest as first arg. 2017-11-15 11:46:49 +11:00
bc.c py/bc: Update opcode_format_table to match the bytecode. 2017-10-10 10:37:38 +11:00
bc.h all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
bc0.h py: Clean up unary and binary enum list to keep groups together. 2017-10-05 10:49:44 +11:00
binary.c py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str. 2017-11-16 13:17:51 +11:00
binary.h
builtin.h py/builtinhelp: Change signature of help text var from pointer to array. 2017-09-12 16:03:52 +10:00
builtinevex.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
builtinhelp.c py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str. 2017-11-16 13:17:51 +11:00
builtinimport.c py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str. 2017-11-16 13:17:51 +11:00
compile.c py/compile: Use alloca instead of qstr_build when compiling import name. 2017-11-01 13:16:16 +11:00
compile.h
emit.h all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
emitbc.c py/emitbc: Remove stray semicolon in outer scope. 2017-09-13 20:36:06 +10:00
emitcommon.c
emitglue.c
emitglue.h
emitinlinethumb.c
emitinlinextensa.c
emitnative.c py/emitnative: Clean up asm macro names so they have dest as first arg. 2017-11-15 11:46:49 +11:00
formatfloat.c py/formatfloat: Use standard isinf, isnan funcs instead of custom ones. 2017-10-10 16:27:54 +11:00
formatfloat.h
frozenmod.c
frozenmod.h
gc.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
gc.h
grammar.h
lexer.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
lexer.h
makeqstrdata.py py/objtype: Fit qstrs for special methods in byte type. 2017-10-21 11:06:32 +03:00
makeqstrdefs.py
makeversionhdr.py
malloc.c py: Make m_malloc_fail() have void return type, since it doesn't return. 2017-08-31 17:00:14 +10:00
map.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
misc.h py: Make m_malloc_fail() have void return type, since it doesn't return. 2017-08-31 17:00:14 +10:00
mkenv.mk py/mkenv.mk: Use $(PYTHON) consistently when calling Python tools. 2017-11-15 11:56:58 +11:00
mkrules.mk py/mkenv.mk: Use $(PYTHON) consistently when calling Python tools. 2017-11-15 11:56:58 +11:00
modarray.c
modbuiltins.c py/modbuiltins: Slightly simplify code in builtin round(). 2017-11-22 15:51:51 +11:00
modcmath.c py: Change obsolete "///" comment formatting to normal comments. 2017-08-30 21:02:00 +10:00
modcollections.c
modgc.c py: Change obsolete "///" comment formatting to normal comments. 2017-08-30 21:02:00 +10:00
modio.c py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str. 2017-11-16 13:17:51 +11:00
modmath.c py/modmath: Convert log2 macro into a function. 2017-10-10 16:01:04 +11:00
modmicropython.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
modstruct.c py/modstruct: Check and prevent buffer-write overflow in struct packing. 2017-09-01 11:11:09 +10:00
modsys.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
modthread.c py: Add config option to print warnings/errors to stderr. 2017-09-26 11:59:11 +10:00
moduerrno.c
mpconfig.h py: Add config option to disable multiple inheritance. 2017-11-20 16:18:50 +11:00
mperrno.h
mphal.h
mpprint.c py/mpprint: Only check for null string printing when NDEBUG not defined. 2017-10-04 18:07:32 +11:00
mpprint.h
mpstate.c
mpstate.h extmod/uos_dupterm: Update uos.dupterm() and helper funcs to have index. 2017-10-13 20:01:57 +11:00
mpthread.h
mpz.c
mpz.h
nativeglue.c py/emitnative: Implement floor-division and modulo for viper emitter. 2017-10-11 18:54:34 +11:00
nlr.h
nlrsetjmp.c
nlrthumb.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
nlrx64.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
nlrx86.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
nlrxtensa.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
obj.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
obj.h py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str. 2017-11-16 13:17:51 +11:00
objarray.c py/runtime: Add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN. 2017-11-24 14:48:23 +11:00
objarray.h
objattrtuple.c
objbool.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objboundmeth.c
objcell.c
objclosure.c
objcomplex.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objdict.c py/runtime: Add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN. 2017-11-24 14:48:23 +11:00
objenumerate.c
objexcept.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objexcept.h
objfilter.c
objfloat.c py/objfloat: Allow float() to parse anything with the buffer protocol. 2017-11-21 15:01:38 +11:00
objfun.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objfun.h
objgenerator.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objgenerator.h
objgetitemiter.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objint.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objint.h py/modbuiltins: Implement abs() by dispatching to MP_UNARY_OP_ABS. 2017-09-18 00:06:43 +03:00
objint_longlong.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objint_mpz.c py/runtime: Add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN. 2017-11-24 14:48:23 +11:00
objlist.c all: Use NULL instead of "" when calling mp_raise exception helpers. 2017-10-24 22:39:36 +11:00
objlist.h
objmap.c
objmodule.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objmodule.h
objnamedtuple.c py/objnamedtuple: Allow to reuse namedtuple basic functionality. 2017-11-20 09:30:06 +02:00
objnamedtuple.h py/objnamedtuple: Allow to reuse namedtuple basic functionality. 2017-11-20 09:30:06 +02:00
objnone.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objobject.c
objpolyiter.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objproperty.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objrange.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objreversed.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objset.c py/runtime: Add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN. 2017-11-24 14:48:23 +11:00
objsingleton.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objslice.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objstr.c py/runtime: Add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN. 2017-11-24 14:48:23 +11:00
objstr.h py/objstr: Make mp_obj_new_str_of_type check for existing interned qstr. 2017-11-16 13:53:04 +11:00
objstringio.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objstringio.h
objstrunicode.c py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str. 2017-11-16 13:17:51 +11:00
objtuple.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objtuple.h
objtype.c py/runtime: Add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN. 2017-11-24 14:48:23 +11:00
objtype.h
objzip.c
opmethods.c py/runtime: Add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN. 2017-11-24 14:48:23 +11:00
parse.c py/objstr: Make mp_obj_new_str_of_type check for existing interned qstr. 2017-11-16 13:53:04 +11:00
parse.h
parsenum.c
parsenum.h
parsenumbase.c
parsenumbase.h
persistentcode.c py/persistentcode: Bump .mpy version number to version 3. 2017-10-05 10:49:44 +11:00
persistentcode.h
py.mk esp8266: Set DEFPSIZE=1024, MINCACHE=3 for "btree" module. 2017-09-10 13:54:00 +03:00
qstr.c py/compile: Use alloca instead of qstr_build when compiling import name. 2017-11-01 13:16:16 +11:00
qstr.h py/compile: Use alloca instead of qstr_build when compiling import name. 2017-11-01 13:16:16 +11:00
qstrdefs.h py/qstrdefs: Remove unused qstrs. 2017-09-01 15:22:25 +10:00
reader.c
reader.h
repl.c
repl.h
ringbuf.h
runtime.c py/runtime: Add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN. 2017-11-24 14:48:23 +11:00
runtime.h py/objtype: Fit qstrs for special methods in byte type. 2017-10-21 11:06:32 +03:00
runtime0.h py/runtime: Add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN. 2017-11-24 14:48:23 +11:00
runtime_utils.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
scheduler.c
scope.c
scope.h
sequence.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
showbc.c py: Clean up unary and binary enum list to keep groups together. 2017-10-05 10:49:44 +11:00
smallint.c
smallint.h
stackctrl.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
stackctrl.h
stream.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
stream.h
unicode.c py/objstr: Add check for valid UTF-8 when making a str from bytes. 2017-09-06 16:43:09 +10:00
unicode.h py/objstr: Add check for valid UTF-8 when making a str from bytes. 2017-09-06 16:43:09 +10:00
vm.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
vmentrytable.h py: Clean up unary and binary enum list to keep groups together. 2017-10-05 10:49:44 +11:00
vstr.c py/vstr: Raise a RuntimeError if fixed vstr buffer overflows. 2017-09-21 20:29:41 +10:00
warning.c py: Add config option to print warnings/errors to stderr. 2017-09-26 11:59:11 +10:00