summaryrefslogtreecommitdiffstatshomepage
path: root/py
Commit message (Collapse)AuthorAge
* py: Add support for floats in mp_binary_{get,set}_val()David Steinberg2015-01-27
| | | | - This then provides support for floats in the struct package
* py: Specify unary/binary op name in TypeError error message.Damien George2015-01-27
| | | | | | | Eg, "() + 1" now tells you that __add__ is not supported for tuple and int types (before it just said the generic "binary operator"). We reuse the table of names for slot lookup because it would be a waste of code space to store the pretty name for each operator.
* py: Fix comparison of minus-zero long int.Damien George2015-01-27
|
* py: Check for NDEBUG using #ifdef rather than #if.Damien George2015-01-25
| | | | | Defining NDEBUG (to any value, even 0) disables debugging. Otherwise, if it's not defined, debugging is enabled.
* py: Don't use anonymous unions, name them instead.Damien George2015-01-24
| | | | This makes the code (more) compatible with the C99 standard.
* py: Be more machine-portable with size of bit fields.Damien George2015-01-24
|
* py: Use float-to-int classifications for mp_obj_new_int_from_float() functionsDavid Steinberg2015-01-24
|
* py: Add float-to-int classification functionDavid Steinberg2015-01-24
|
* py: Fix issue in mpz_set_from_float() when mp_int_t is larger than floatDavid Steinberg2015-01-24
|
* py: Move mp_float_t related defines to misc.hDavid Steinberg2015-01-24
|
* py: Fix segfault in namedtuple when name is a non-interned stringstijn2015-01-24
| | | | | | | | - namedtuple was wrongly using MP_OBJ_QSTR_VALUE instead of mp_obj_str_get_qstr, so when passed a non-interned string it would segfault; fix this by using mp_obj_str_get_qstr - store the namedtuple field names as qstrs so it is not needed to use mp_obj_str_get_qstr everytime the field name has to be accessed. This also slighty increases performance when fetching attributes
* binary: Rework array accessors. They work with native, not stdint types.Paul Sokolovsky2015-01-24
|
* stream: readall(): Make sure there's a trailing NUL char.Paul Sokolovsky2015-01-24
|
* stream: Fix readall() implementation in respect to NUL terminator bytes.Paul Sokolovsky2015-01-23
| | | | After vstr refactor. Fixes #1084.
* objstr: Remove code duplication and unbreak Windows build.Paul Sokolovsky2015-01-23
| | | | | | | | There was really weird warning (promoted to error) when building Windows port. Exact cause is still unknown, but it uncovered another issue: 8-bit and unicode str_make_new implementations should be mutually exclusive, and not built at the same time. What we had is that bytes_decode() pulled 8-bit str_make_new() even for unicode build.
* objstr*: Use separate names for locals_dict of 8-bit and unicode str's.Paul Sokolovsky2015-01-23
| | | | To somewhat unbreak -DSTATIC="" compile.
* py: Allow asmx64 to compile with -Wsign-compare.Damien George2015-01-22
| | | | See issue #699.
* stmhal: Put mod_network_nic_list in global root-pointer state.Damien George2015-01-22
| | | | It needs to be scanned by GC. Thanks to Daniel Campora.
* py: Add comments for vstr_init and mp_obj_new_str.Damien George2015-01-21
|
* py: Remove mp_obj_str_builder and use vstr instead.Damien George2015-01-21
| | | | | | | | | | | | With this patch str/bytes construction is streamlined. Always use a vstr to build a str/bytes object. If the size is known beforehand then use vstr_init_len to allocate only required memory. Otherwise use vstr_init and the vstr will grow as needed. Then use mp_obj_new_str_from_vstr to create a str/bytes object using the vstr memory. Saves code ROM: 68 bytes on stmhal, 108 bytes on bare-arm, and 336 bytes on unix x64.
* py: Add mp_obj_new_str_from_vstr, and use it where relevant.Damien George2015-01-21
| | | | | | | | This patch allows to reuse vstr memory when creating str/bytes object. This improves memory usage. Also saves code ROM: 128 bytes on stmhal, 92 bytes on bare-arm, and 88 bytes on unix x64.
* builtinimport: Make sure that qstr is used properly to load frozen modules.Paul Sokolovsky2015-01-21
|
* py: Implement proper re-raising in native codegen's finally handler.Damien George2015-01-21
| | | | | This allows an exception to propagate correctly through a finally handler.
* py: Implement __reversed__ slot.Damien George2015-01-21
| | | | Addresses issue #1073.
* py: Prevent segfault for operations on closed StringIO.stijn2015-01-20
| | | | Addresses issue #1067.
* py: Use mp_arg_check_num in some _make_new functions.Damien George2015-01-20
| | | | Reduces stmhal code size by about 250 bytes.
* py, unix: Allow to compile with -Wunused-parameter.Damien George2015-01-20
| | | | See issue #699.
* py, unix, stmhal: Allow to compile with -Wshadow.Damien George2015-01-20
| | | | See issue #699.
* py: Implement very simple frozen modules support.Paul Sokolovsky2015-01-20
| | | | | Only modules (not packages) supported now. Source modules can be converted to frozen module structures using tools/make-frozen.py script.
* py, unix: Allow to compile with -Wsign-compare.Damien George2015-01-16
| | | | See issue #699.
* py: Remove unnecessary id_flags argument from emitter's load_fast.Damien George2015-01-16
| | | | Saves 24 bytes in bare-arm.
* pyexec: Add event-driven variant pyexec_friendly_repl().Paul Sokolovsky2015-01-16
| | | | | | | | | | pyexec_friendly_repl_process_char() and friends, useful for ports which integrate into existing cooperative multitasking system. Unlike readline() refactor before, this was implemented in less formal, trial&error process, minor functionality regressions are still known (like soft&hard reset support). So, original loop-based pyexec_friendly_repl() is left intact, specific implementation selectable by config setting.
* py: Add "default" to switches to allow better code flow analysis.Damien George2015-01-14
| | | | | This helps compiler produce smaller code. Saves 124 bytes on stmhal and bare-arm.
* py: Only allocate strings/bytes once for load_const_obj.Damien George2015-01-14
|
* py: Allocate memory for assembled code at start of PASS_EMIT.Damien George2015-01-14
| | | | | Previously was allocating at end of PASS_COMPUTE, and this pass was being run twice, so memory was being allocated twice.
* py: Reluctantly add an extra pass to bytecode compiler.Damien George2015-01-14
| | | | | | | | | | | | | | | Bytecode also needs a pass to compute the stack size. This is because the state size of the bytecode function is encoded as a variable uint, so we must know the value of this uint before we encode it (otherwise the size of the generated code changes from one pass to the next). Having an entire pass for this seems wasteful (in time). Alternative is to allocate fixed space for the state size (would need 3-4 bytes to be general, when 1 byte is usually sufficient) which uses a bit of extra RAM per bytecode function, and makes the code less elegant in places where this uint is encoded/decoded. So, for now, opt for an extra pass.
* py, unix: Trace root pointers with native emitter under unix port.Damien George2015-01-14
| | | | | | Native code has GC-heap pointers in it so it must be scanned. But on unix port memory for native functions is mmap'd, and so it must have explicit code to scan it for root pointers.
* py: Make compiler not crash when default except is not last.Damien George2015-01-13
|
* py/showbc.c: Handle new LOAD_CONST_OBJ opcode, and opcodes with cache.Damien George2015-01-13
|
* py: Never intern data of large string/bytes object; add relevant tests.Damien George2015-01-13
| | | | | | | | | | Previously to this patch all constant string/bytes objects were interned by the compiler, and this lead to crashes when the qstr was too long (noticeable now that qstr length storage defaults to 1 byte). With this patch, long string/bytes objects are never interned, and are referenced directly as constant objects within generated code using load_const_obj.
* py: Add load_const_obj to emitter, add LOAD_CONST_OBJ to bytecode.Damien George2015-01-13
| | | | | This allows to directly load a Python object to the Python stack. See issue #722 for background.
* py: Allow to compile with -Wstrict-prototypes.Damien George2015-01-12
|
* py: Allow to compile with -Wredundant-decls.Damien George2015-01-12
|
* py, unix, lib: Allow to compile with -Wold-style-definition.Damien George2015-01-12
|
* py: Can compile with -Wmissing-declarations and -Wmissing-prototypes.Damien George2015-01-12
|
* py: Make a function static and comment out those not used.Damien George2015-01-12
|
* py, unix: Allow to compile with -Wdouble-promotion.Damien George2015-01-12
| | | | Ref issue #699.
* py/makeqstrdata.py: Make it work again with both Python2 and Python3.Damien George2015-01-11
|
* py: Add MICROPY_QSTR_BYTES_IN_LEN config option, defaulting to 1.Damien George2015-01-11
| | | | | | | | | | | | | | | | | | This new config option sets how many fixed-number-of-bytes to use to store the length of each qstr. Previously this was hard coded to 2, but, as per issue #1056, this is considered overkill since no-one needs identifiers longer than 255 bytes. With this patch the number of bytes for the length is configurable, and defaults to 1 byte. The configuration option filters through to the makeqstrdata.py script. Code size savings going from 2 to 1 byte: - unix x64 down by 592 bytes - stmhal down by 1148 bytes - bare-arm down by 284 bytes Also has RAM savings, and will be slightly more efficient in execution.
* py: Add qstr cfg capability; generate QSTR_NULL and QSTR_ from script.Damien George2015-01-11
|