summaryrefslogtreecommitdiff
path: root/py/modbuiltins.c
AgeCommit message (Collapse)Author
2015-04-16py: Overhaul and simplify printf/pfenv mechanism.Damien George
Previous to this patch the printing mechanism was a bit of a tangled mess. This patch attempts to consolidate printing into one interface. All (non-debug) printing now uses the mp_print* family of functions, mainly mp_printf. All these functions take an mp_print_t structure as their first argument, and this structure defines the printing backend through the "print_strn" function of said structure. Printing from the uPy core can reach the platform-defined print code via two paths: either through mp_sys_stdout_obj (defined pert port) in conjunction with mp_stream_write; or through the mp_plat_print structure which uses the MP_PLAT_PRINT_STRN macro to define how string are printed on the platform. The former is only used when MICROPY_PY_IO is defined. With this new scheme printing is generally more efficient (less layers to go through, less arguments to pass), and, given an mp_print_t* structure, one can call mp_print_str for efficiency instead of mp_printf("%s", ...). Code size is also reduced by around 200 bytes on Thumb2 archs.
2015-04-09py: Use a dummy type for referring to extern structsstijn
Fixes msvc linker warnings about mismatching sizes between the mp_obj_fdfile_t struct defined in file.c and the mp_uint_t declarations found in modsys.c and modbuiltins.c
2015-04-07py: Add MICROPY_PY_BUILTINS_REVERSED, disable for minimal ports.Paul Sokolovsky
2015-04-06py: Add MICROPY_PY_BUILTINS_ENUMERATE, disable for minimal ports.Paul Sokolovsky
2015-03-31modbuiltins: round(): Accept second arg, and at least support it to be 0.Paul Sokolovsky
Per https://docs.python.org/3/library/functions.html#round, 2-args format guaranteedly returns float.
2015-03-19py: Allow to compile with extra warnings (sign-compare, unused-param).Damien George
2015-03-14py: Fix builtin abs so it works for bools and bignum.Damien George
2015-03-02py: Use SMALL_INT creation macro in builtin sum.Damien George
2015-02-23py: Implement UnicodeError.Paul Sokolovsky
Still too shy to implement UnicodeEncodeError which was really needed for micropython-lib case.
2015-02-14py: Add setattr builtin.stijn
2015-01-28py: Make REPL printing function print repr of object, not str.Damien George
Addresses issue #1014.
2015-01-28py: Be more precise about unicode type and disabled unicode behaviour.Damien George
2015-01-21py: Add mp_obj_new_str_from_vstr, and use it where relevant.Damien George
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.
2015-01-12py: Can compile with -Wmissing-declarations and -Wmissing-prototypes.Damien George
2015-01-04modbuiltins.c: Fix NULL vs MP_OBJ_NULL usage.Paul Sokolovsky
2015-01-04objstr: Implement kwargs support for str.format().Paul Sokolovsky
2015-01-01py: Move to guarded includes, everywhere in py/ core.Damien George
Addresses issue #1022.
2014-12-27py: Allow to properly disable builtin "set" object.Damien George
This patch makes MICROPY_PY_BUILTINS_SET compile-time option fully disable the builtin set object (when set to 0). This includes removing set constructor/comprehension from the grammar, the compiler and the emitters. Now, enabling set costs 8168 bytes on unix x64, and 3576 bytes on stmhal.
2014-12-19py: Add execfile function (from Python 2); enable in stmhal port.Damien George
Adds just 60 bytes to stmhal binary. Addresses issue #362.
2014-12-09py: Allow builtins to be overridden.Damien George
This patch adds a configuration option (MICROPY_CAN_OVERRIDE_BUILTINS) which, when enabled, allows to override all names within the builtins module. A builtins override dict is created the first time the user assigns to a name in the builtins model, and then that dict is searched first on subsequent lookups. Note that this implementation doesn't allow deleting of names. This patch also does some refactoring of builtins code, creating the modbuiltins.c file. Addresses issue #959.