micropython/py
Damien George 19f2e47d59 py: Add very simple but correct hashing for float and complex numbers.
Hashing of float and complex numbers that are exact (real) integers should
return the same integer hash value as hashing the corresponding integer
value.  Eg hash(1), hash(1.0) and hash(1+0j) should all be the same (this
is how Python is specified: if x==y then hash(x)==hash(y)).

This patch implements the simplest way of doing float/complex hashing by
just converting the value to int and returning that value.
2017-04-04 11:57:21 +10:00
..
argcheck.c py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible. 2017-03-28 22:37:26 +11:00
asmarm.c py/asmarm: Fix assembler's PASS_EMIT constant name. 2017-01-03 15:40:50 +11:00
asmarm.h py: Move arch-specific assembler macros from emitnative to asmXXX.h. 2016-12-09 16:51:49 +11:00
asmbase.c py/asm: Remove need for dummy_data when doing initial assembler passes. 2016-12-09 22:50:58 +11:00
asmbase.h py/asm: Remove need for dummy_data when doing initial assembler passes. 2016-12-09 22:50:58 +11:00
asmthumb.c py/asm: Remove need for dummy_data when doing initial assembler passes. 2016-12-09 22:50:58 +11:00
asmthumb.h py: Move arch-specific assembler macros from emitnative to asmXXX.h. 2016-12-09 16:51:49 +11:00
asmx64.c py/asm: Remove need for dummy_data when doing initial assembler passes. 2016-12-09 22:50:58 +11:00
asmx64.h py/asm: Remove need for dummy_data when doing initial assembler passes. 2016-12-09 22:50:58 +11:00
asmx86.c py/asm: Fix x86 and ARM assemblers due to recent code refactoring. 2016-12-09 22:54:45 +11:00
asmx86.h py/asm: Remove need for dummy_data when doing initial assembler passes. 2016-12-09 22:50:58 +11:00
asmxtensa.c py/asm: Remove need for dummy_data when doing initial assembler passes. 2016-12-09 22:50:58 +11:00
asmxtensa.h py/asmxtensa.h: Explicitly cast args to 32-bits so left-shift is legal. 2017-02-08 10:48:51 +11:00
bc.c py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible. 2017-03-28 22:37:26 +11:00
bc.h py: Provide mp_decode_uint_value to help optimise stack usage. 2017-03-17 16:50:19 +11:00
bc0.h py: Allow bytecode/native to put iter_buf on stack for simple for loops. 2017-02-16 18:38:06 +11:00
binary.c py/binary: mp_binary_get_size: Raise error on unsupported typecodes. 2017-01-17 22:53:06 +03:00
binary.h
builtin.h py: Add builtin help function to core, with default help msg. 2017-01-22 11:56:16 +11:00
builtinevex.c py: Change mp_uint_t to size_t for mp_obj_str_get_data len arg. 2017-03-29 12:56:45 +11:00
builtinhelp.c py/builtinhelp: Implement help('modules') to list available modules. 2017-01-22 12:12:54 +11:00
builtinimport.c py: Change mp_uint_t to size_t for mp_obj_str_get_data len arg. 2017-03-29 12:56:45 +11:00
compile.c py/compile: Provide terse error message for invalid dict/set literals. 2017-03-29 12:44:27 +11:00
compile.h py: Allow inline-assembler emitter to be generic. 2016-12-09 17:06:21 +11:00
emit.h py: Remove unused "use_stack" argument from for_iter_end emit function. 2017-02-16 18:38:06 +11:00
emitbc.c py: Define and use MP_OBJ_ITER_BUF_NSLOTS to get size of stack iter buf. 2017-03-23 16:36:08 +11:00
emitcommon.c py/scope: Factor common code to find locals and close over them. 2016-09-30 13:53:00 +10:00
emitglue.c py/emitglue: Refactor to remove assert(0), to improve coverage. 2016-12-21 11:52:05 +11:00
emitglue.h py: Factor persistent code load/save funcs into persistentcode.[ch]. 2016-11-16 16:14:14 +11:00
emitinlinethumb.c py: Create str/bytes objects in the parser, not the compiler. 2017-02-24 13:43:43 +11:00
emitinlinextensa.c py/emitinline: Move common code for end of final pass to compiler. 2016-12-09 21:23:17 +11:00
emitnative.c py: Define and use MP_OBJ_ITER_BUF_NSLOTS to get size of stack iter buf. 2017-03-23 16:36:08 +11:00
formatfloat.c py/formatfloat: Remove unreachable code. 2017-01-19 23:32:16 +11:00
formatfloat.h
frozenmod.c
frozenmod.h
gc.c
gc.h
grammar.h py/grammar: Remove unused rule. 2017-02-17 12:48:45 +11:00
lexer.c py/lexer: Simplify and reduce code size for operator tokenising. 2017-03-29 10:56:52 +11:00
lexer.h py/lexer: Convert mp_uint_t to size_t where appropriate. 2017-02-17 12:44:24 +11:00
makeqstrdata.py
makeqstrdefs.py
makeversionhdr.py
malloc.c
map.c py/map: Fix bugs with deletion of elements from OrderedDict. 2017-03-03 11:21:19 +11:00
misc.h cc3200: Re-add support for UART REPL (MICROPY_STDIO_UART setting). 2016-12-27 01:05:37 +03:00
mkenv.mk py: Move frozen bytecode Makefile rules from ports to common mk files. 2016-11-08 14:28:30 +11:00
mkrules.mk zephyr/Makefile: Rework to use modern, official build integration. 2017-03-30 00:08:27 +03:00
modarray.c
modbuiltins.c py: Change mp_uint_t to size_t for mp_obj_str_get_data len arg. 2017-03-29 12:56:45 +11:00
modcmath.c
modcollections.c
modgc.c
modio.c py: Add mp_raise_OSError(errno) helper function. 2016-10-07 13:31:59 +11:00
modmath.c py/modmath: Allow trunc/ceil/floor to return a big int if necessary. 2017-03-23 22:57:08 +11:00
modmicropython.c py: Add micropython.schedule() function and associated runtime code. 2017-03-20 15:20:26 +11:00
modstruct.c py/binary: mp_binary_get_size: Raise error on unsupported typecodes. 2017-01-17 22:53:06 +03:00
modsys.c py/modsys: Use MP_SMALL_INT_MAX for sys.maxsize in case of LONGINT_IMPL_NONE. 2017-03-06 12:15:25 +01:00
modthread.c py: Convert mp_uint_t to size_t for tuple/list accessors. 2017-03-29 12:56:17 +11:00
moduerrno.c py/moduerrno: Make list of errno codes configurable. 2017-02-22 12:58:11 +11:00
mpconfig.h py/objstr: Use MICROPY_FULL_CHECKS for range checking when constructing bytes. 2017-04-02 21:20:07 +03:00
mperrno.h
mphal.h extmod/utime_mphal: Factor out implementations in terms of mp_hal_* for reuse. 2016-10-14 20:14:01 +03:00
mpprint.c py/mpprint: Fix int formatting so "+" is printed for 0-valued integer. 2017-03-15 17:25:12 +11:00
mpprint.h lib/utils/pyhelp.c: Use mp_printf() instead of printf() 2016-10-21 18:30:58 +11:00
mpstate.c
mpstate.h py: Remove MP_STATE_CTX, use MP_STATE_THREAD instead (it's an alias). 2017-03-24 18:43:28 +11:00
mpthread.h
mpz.c py/mpz: Change type of "base" args from mp_uint_t to unsigned int. 2017-02-16 16:51:16 +11:00
mpz.h py/mpz: Change type of "base" args from mp_uint_t to unsigned int. 2017-02-16 16:51:16 +11:00
nativeglue.c py: Optimise storage of iterator so it takes only 4 slots on Py stack. 2017-02-16 18:38:06 +11:00
nlr.h py/nlr.h: Mark nlr_jump_fail as NORETURN. 2017-03-06 17:13:16 +11:00
nlrsetjmp.c
nlrthumb.c
nlrx64.c py/nlrx64: Fixes to support Mac OS. 2017-03-08 22:36:02 +11:00
nlrx86.c py/nlrx86: Better check for Zephyr (requires 1.7). 2017-03-26 00:33:23 +03:00
nlrxtensa.c py/nlrxtensa: Convert from assembler to C file with inline asm. 2017-03-06 17:13:16 +11:00
obj.c py: Convert mp_uint_t to size_t for tuple/list accessors. 2017-03-29 12:56:17 +11:00
obj.h py: Add very simple but correct hashing for float and complex numbers. 2017-04-04 11:57:21 +10:00
objarray.c py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible. 2017-03-28 22:37:26 +11:00
objarray.h py/objarray: Convert mp_uint_t to size_t where appropriate. 2017-02-16 16:51:16 +11:00
objattrtuple.c py/objtuple: Convert mp_uint_t to size_t where appropriate. 2017-02-16 16:51:16 +11:00
objbool.c py/objbool: Make a slight simplification of bool constructor. 2016-09-30 17:02:07 +10:00
objboundmeth.c py/objtype: Implement __call__ handling for an instance w/o heap alloc. 2016-11-22 01:33:55 +03:00
objcell.c
objclosure.c py/objclosure: Convert mp_uint_t to size_t where appropriate. 2017-02-16 16:51:17 +11:00
objcomplex.c py: Add very simple but correct hashing for float and complex numbers. 2017-04-04 11:57:21 +10:00
objdict.c py: Shorten a couple of error messages. 2017-03-29 12:36:46 +11:00
objenumerate.c py: Add iter_buf to getiter type method. 2017-02-16 18:38:06 +11:00
objexcept.c py/objexcept: Convert mp_uint_t to size_t where appropriate. 2017-02-16 16:51:17 +11:00
objexcept.h py/objexcept: Convert mp_uint_t to size_t where appropriate. 2017-02-16 16:51:17 +11:00
objfilter.c py: Add iter_buf to getiter type method. 2017-02-16 18:38:06 +11:00
objfloat.c py: Add very simple but correct hashing for float and complex numbers. 2017-04-04 11:57:21 +10:00
objfun.c py: Change mp_uint_t to size_t for mp_obj_str_get_data len arg. 2017-03-29 12:56:45 +11:00
objfun.h
objgenerator.c py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible. 2017-03-28 22:37:26 +11:00
objgenerator.h
objgetitemiter.c py: Add iter_buf to getiter type method. 2017-02-16 18:38:06 +11:00
objint.c py: Change mp_uint_t to size_t for mp_obj_str_get_data len arg. 2017-03-29 12:56:45 +11:00
objint.h py: Added optimised support for 3-argument calls to builtin.pow() 2017-02-02 22:23:10 +03:00
objint_longlong.c py/objint_longlong: Implement mp_obj_int_from_bytes_impl(). 2017-03-10 00:22:53 +01:00
objint_mpz.c py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible. 2017-03-28 22:37:26 +11:00
objlist.c py: Convert mp_uint_t to size_t for tuple/list accessors. 2017-03-29 12:56:17 +11:00
objlist.h py/objlist: Convert mp_uint_t to size_t where appropriate. 2017-02-16 16:51:16 +11:00
objmap.c py/objmap: Convert mp_uint_t to size_t. 2017-03-27 12:19:24 +11:00
objmodule.c py/objmodule: Move module init/deinit code into runtime functions. 2017-01-26 23:30:38 +11:00
objmodule.h py/objmodule: Move module init/deinit code into runtime functions. 2017-01-26 23:30:38 +11:00
objnamedtuple.c py: Convert mp_uint_t to size_t for tuple/list accessors. 2017-03-29 12:56:17 +11:00
objnone.c
objobject.c py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible. 2017-03-28 22:37:26 +11:00
objpolyiter.c py: Add iter_buf to getiter type method. 2017-02-16 18:38:06 +11:00
objproperty.c
objrange.c py: Use size_t as len argument and return type of mp_get_index. 2017-03-23 16:17:40 +11:00
objreversed.c py: Add iter_buf to getiter type method. 2017-02-16 18:38:06 +11:00
objset.c py: De-optimise some uses of mp_getiter, so they don't use the C stack. 2017-02-16 19:11:34 +11:00
objsingleton.c
objslice.c
objstr.c py/objstr: Use MICROPY_FULL_CHECKS for range checking when constructing bytes. 2017-04-02 21:20:07 +03:00
objstr.h py/objstr: Convert mp_uint_t to size_t (and use int) where appropriate. 2017-02-16 16:51:16 +11:00
objstringio.c py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible. 2017-03-28 22:37:26 +11:00
objstringio.h extmod/modujson: Implement ujson.load() to load JSON from a stream. 2016-10-13 11:46:14 +11:00
objstrunicode.c py: Use size_t as len argument and return type of mp_get_index. 2017-03-23 16:17:40 +11:00
objtuple.c py: Convert mp_uint_t to size_t for tuple/list accessors. 2017-03-29 12:56:17 +11:00
objtuple.h py: Add iter_buf to getiter type method. 2017-02-16 18:38:06 +11:00
objtype.c py: Convert mp_uint_t to size_t for tuple/list accessors. 2017-03-29 12:56:17 +11:00
objtype.h
objzip.c py/objzip: Convert mp_uint_t to size_t. 2017-03-30 22:58:08 +11:00
opmethods.c
parse.c py/parse: Simplify handling of errors by raising them directly. 2017-02-24 14:56:37 +11:00
parse.h py/parse: Make mp_parse_node_new_leaf an inline function. 2016-11-15 16:48:48 +11:00
parsenum.c py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible. 2017-03-28 22:37:26 +11:00
parsenum.h
parsenumbase.c
parsenumbase.h
persistentcode.c py: Allow lexer to raise exceptions during construction. 2017-03-14 11:52:05 +11:00
persistentcode.h py: Factor out persistent-code reader into separate files. 2016-11-16 18:13:50 +11:00
py.mk all: Use full path name when including mp-readline/timeutils/netutils. 2017-03-31 22:29:39 +11:00
qstr.c py: Fix wrong assumption that m_renew will not move if shrinking 2016-11-02 23:15:41 +11:00
qstr.h
qstrdefs.h extmod: Add generic VFS sub-system. 2017-01-27 17:19:06 +11:00
reader.c py: Allow lexer to raise exceptions during construction. 2017-03-14 11:52:05 +11:00
reader.h py: Allow lexer to raise exceptions during construction. 2017-03-14 11:52:05 +11:00
repl.c py: Change mp_uint_t to size_t for mp_obj_str_get_data len arg. 2017-03-29 12:56:45 +11:00
repl.h
ringbuf.h
runtime.c py: Change mp_uint_t to size_t for mp_obj_str_get_data len arg. 2017-03-29 12:56:45 +11:00
runtime.h py: Remove MP_STATE_CTX, use MP_STATE_THREAD instead (it's an alias). 2017-03-24 18:43:28 +11:00
runtime0.h py: Optimise storage of iterator so it takes only 4 slots on Py stack. 2017-02-16 18:38:06 +11:00
runtime_utils.c
scheduler.c py: Add micropython.schedule() function and associated runtime code. 2017-03-20 15:20:26 +11:00
scope.c py/scope: Factor common code to find locals and close over them. 2016-09-30 13:53:00 +10:00
scope.h py/scope: Factor common code to find locals and close over them. 2016-09-30 13:53:00 +10:00
sequence.c py: Use mp_raise_TypeError/mp_raise_ValueError helpers where possible. 2017-03-28 22:37:26 +11:00
showbc.c py: Allow bytecode/native to put iter_buf on stack for simple for loops. 2017-02-16 18:38:06 +11:00
smallint.c
smallint.h
stackctrl.c
stackctrl.h
stream.c all: Remove readall() method, which is equivalent to read() w/o args. 2016-11-14 00:24:22 +03:00
stream.h py/stream: Move ad-hoc ioctl constants to stream.h and rename them. 2016-12-02 16:37:29 +11:00
unicode.c py/unicode: Comment-out unused function unichar_isprint. 2016-12-28 17:50:10 +11:00
unicode.h
vm.c py/vm: Fix VM opcode tracing to print correct stack pointer. 2017-03-27 10:52:04 +11:00
vmentrytable.h py: Allow bytecode/native to put iter_buf on stack for simple for loops. 2017-02-16 18:38:06 +11:00
vstr.c py/vstr: Combine vstr_new_size with vstr_new since they are rarely used. 2016-10-14 16:46:34 +11:00
warning.c py: fix null pointer dereference in mpz.c, fix missing va_end in warning.c 2016-10-31 23:21:15 +03:00