1. 20 Feb, 2018 3 commits
  2. 13 Dec, 2017 1 commit
  3. 11 Dec, 2017 1 commit
  4. 16 Nov, 2017 1 commit
    • 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
  5. 04 Oct, 2017 1 commit
    • 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
  6. 15 Aug, 2017 1 commit
  7. 31 Jul, 2017 1 commit
  8. 07 Jul, 2017 1 commit
  9. 04 Jul, 2017 1 commit
  10. 28 Jun, 2017 1 commit
    • Damien George's avatar
      py/builtinimport: Remove unreachable code for relative imports. · 2f7fad66
      Damien George authored
      The while-loop that calls chop_component will guarantee that level==-1 at
      the end of the loop.  Hence the code following it is unnecessary.
      
      The check for p==this_name will catch imports that are beyond the
      top-level, and also covers the case of new_mod_q==MP_QSTR_ (equivalent to
      new_mod_l==0) so that check is removed.
      
      There is also a new check at the start for level>=0 to guard against
      __import__ being called with bad level values.
      2f7fad66
  11. 15 Jun, 2017 1 commit
  12. 29 May, 2017 1 commit
  13. 09 May, 2017 1 commit
  14. 29 Mar, 2017 2 commits
    • Damien George's avatar
    • Damien George's avatar
      py: Convert mp_uint_t to size_t for tuple/list accessors. · 6213ad7f
      Damien George authored
      This patch changes mp_uint_t to size_t for the len argument of the
      following public facing C functions:
      
      mp_obj_tuple_get
      mp_obj_list_get
      mp_obj_get_array
      
      These functions take a pointer to the len argument (to be filled in by the
      function) and callers of these functions should update their code so the
      type of len is changed to size_t.  For ports that don't use nan-boxing
      there should be no change in generate code because the size of the type
      remains the same (word sized), and in a lot of cases there won't even be a
      compiler warning if the type remains as mp_uint_t.
      
      The reason for this change is to standardise on the use of size_t for
      variables that count memory (or memory related) sizes/lengths.  It helps
      builds that use nan-boxing.
      6213ad7f
  15. 28 Mar, 2017 1 commit
  16. 14 Mar, 2017 1 commit
    • Damien George's avatar
      py: Allow lexer to raise exceptions during construction. · 1831034b
      Damien George authored
      This patch refactors the error handling in the lexer, to simplify it (ie
      reduce code size).
      
      A long time ago, when the lexer/parser/compiler were first written, the
      lexer and parser were designed so they didn't use exceptions (ie nlr) to
      report errors but rather returned an error code.  Over time that has
      gradually changed, the parser in particular has more and more ways of
      raising exceptions.  Also, the lexer never really handled all errors without
      raising, eg there were some memory errors which could raise an exception
      (and in these rare cases one would get a fatal nlr-not-handled fault).
      
      This patch accepts the fact that the lexer can raise exceptions in some
      cases and allows it to raise exceptions to handle all its errors, which are
      for the most part just out-of-memory errors during construction of the
      lexer.  This makes the lexer a bit simpler, and also the persistent code
      stuff is simplified.
      
      What this means for users of the lexer is that calls to it must be wrapped
      in a nlr handler.  But all uses of the lexer already have such an nlr
      handler for the parser (and compiler) so that doesn't put any extra burden
      on the callers.
      1831034b
  17. 22 Jan, 2017 1 commit
  18. 16 Jan, 2017 2 commits
  19. 08 Jan, 2017 1 commit
  20. 13 Dec, 2016 1 commit
  21. 16 Nov, 2016 1 commit
  22. 17 Oct, 2016 1 commit
  23. 20 Sep, 2016 2 commits
  24. 02 Jul, 2016 1 commit
  25. 23 May, 2016 1 commit
  26. 21 May, 2016 3 commits
  27. 13 Apr, 2016 1 commit
  28. 11 Jan, 2016 1 commit
  29. 18 Dec, 2015 1 commit
    • Damien George's avatar
      py: Add MICROPY_ENABLE_COMPILER and MICROPY_PY_BUILTINS_EVAL_EXEC opts. · dd5353a4
      Damien George authored
      MICROPY_ENABLE_COMPILER can be used to enable/disable the entire compiler,
      which is useful when only loading of pre-compiled bytecode is supported.
      It is enabled by default.
      
      MICROPY_PY_BUILTINS_EVAL_EXEC controls support of eval and exec builtin
      functions.  By default they are only included if MICROPY_ENABLE_COMPILER
      is enabled.
      
      Disabling both options saves about 40k of code size on 32-bit x86.
      dd5353a4
  30. 29 Nov, 2015 2 commits
  31. 13 Nov, 2015 1 commit
  32. 28 Jun, 2015 1 commit
    • Paul Sokolovsky's avatar
      builtinimport: Fix running package submodule with -m. · 9780e552
      Paul Sokolovsky authored
      When "micropython -m pkg.mod" command was used, relative imports in pkg.mod
      didn't work, because pkg.mod.__name__ was set to __main__, and the fact that
      it's a package submodule was missed. This is an original workaround to this
      issue. TODO: investigate and compare how CPython deals with this issue.
      9780e552