Skip to content
Snippets Groups Projects
  1. Feb 12, 2019
    • Damien George's avatar
      py: Downcase all MP_OBJ_IS_xxx macros to make a more consistent C API. · eee1e884
      Damien George authored
      These macros could in principle be (inline) functions so it makes sense to
      have them lower case, to match the other C API functions.
      
      The remaining macros that are upper case are:
      - MP_OBJ_TO_PTR, MP_OBJ_FROM_PTR
      - MP_OBJ_NEW_SMALL_INT, MP_OBJ_SMALL_INT_VALUE
      - MP_OBJ_NEW_QSTR, MP_OBJ_QSTR_VALUE
      - MP_OBJ_FUN_MAKE_SIG
      - MP_DECLARE_CONST_xxx
      - MP_DEFINE_CONST_xxx
      
      These must remain macros because they are used when defining const data (at
      least, MP_OBJ_NEW_SMALL_INT is so it makes sense to have
      MP_OBJ_SMALL_INT_VALUE also a macro).
      
      For those macros that have been made lower case, compatibility macros are
      provided for the old names so that users do not need to change their code
      immediately.
      eee1e884
  2. Feb 05, 2019
  3. Oct 22, 2018
  4. Feb 14, 2018
    • Damien George's avatar
      py/unicode: Clean up utf8 funcs and provide non-utf8 inline versions. · 19aee943
      Damien George authored
      This patch provides inline versions of the utf8 helper functions for the
      case when unicode is disabled (MICROPY_PY_BUILTINS_STR_UNICODE set to 0).
      This saves code size.
      
      The unichar_charlen function is also renamed to utf8_charlen to match the
      other utf8 helper functions, and the signature of this function is adjusted
      for consistency (const char* -> const byte*, mp_uint_t -> size_t).
      19aee943
  5. Nov 16, 2017
    • Damien George's avatar
      py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str. · 4601759b
      Damien George authored
      This patch simplifies the str creation API to favour the common case of
      creating a str object that is not forced to be interned.  To force
      interning of a new str the new mp_obj_new_str_via_qstr function is added,
      and should only be used if warranted.
      
      Apart from simplifying the mp_obj_new_str function (and making it have the
      same signature as mp_obj_new_bytes), this patch also reduces code size by a
      bit (-16 bytes for bare-arm and roughly -40 bytes on the bare-metal archs).
      4601759b
  6. Oct 04, 2017
    • Damien George's avatar
      all: Remove inclusion of internal py header files. · a3dc1b19
      Damien George authored
      Header files that are considered internal to the py core and should not
      normally be included directly are:
          py/nlr.h - internal nlr configuration and declarations
          py/bc0.h - contains bytecode macro definitions
          py/runtime0.h - contains basic runtime enums
      
      Instead, the top-level header files to include are one of:
          py/obj.h - includes runtime0.h and defines everything to use the
              mp_obj_t type
          py/runtime.h - includes mpstate.h and hence nlr.h, obj.h, runtime0.h,
              and defines everything to use the general runtime support functions
      
      Additional, specific headers (eg py/objlist.h) can be included if needed.
      a3dc1b19
  7. Aug 29, 2017
  8. Aug 13, 2017
    • Javier Candeira's avatar
      all: Raise exceptions via mp_raise_XXX · 35a1fea9
      Javier Candeira authored
        - Changed: ValueError, TypeError, NotImplementedError
        - OSError invocations unchanged, because the corresponding utility
          function takes ints, not strings like the long form invocation.
        - OverflowError, IndexError and RuntimeError etc. not changed for now
          until we decide whether to add new utility functions.
      35a1fea9
  9. Jul 31, 2017
  10. Jun 15, 2017
  11. Mar 23, 2017
  12. Feb 16, 2017
  13. Aug 07, 2016
  14. Jul 25, 2016
  15. May 21, 2016
  16. Jan 03, 2016
  17. Nov 29, 2015
  18. Oct 11, 2015
  19. Sep 03, 2015
  20. May 17, 2015
  21. Apr 16, 2015
    • Damien George's avatar
      py: Overhaul and simplify printf/pfenv mechanism. · 7f9d1d6a
      Damien George authored
      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.
      7f9d1d6a
  22. Apr 04, 2015
  23. Apr 03, 2015
    • Paul Sokolovsky's avatar
      objstr: Add .splitlines() method. · ac2f7a7f
      Paul Sokolovsky authored
      splitlines() occurs ~179 times in CPython3 standard library, so was
      deemed worthy to implement. The method has subtle semantic differences
      from just .split("\n"). It is also defined as working for any end-of-line
      combination, but this is currently not implemented - it works only with
      LF line-endings (which should be OK for text strings on any platforms,
      but not OK for bytes).
      ac2f7a7f
  24. Mar 19, 2015
  25. Jan 28, 2015
  26. Jan 23, 2015
  27. Jan 21, 2015
  28. Jan 20, 2015
  29. Jan 01, 2015
  30. Oct 30, 2014
  31. Sep 25, 2014
  32. Sep 17, 2014
  33. Aug 30, 2014
  34. Aug 29, 2014
Loading