summaryrefslogtreecommitdiff
path: root/py/builtinimport.c
AgeCommit message (Collapse)Author
2014-10-03py: Convert [u]int to mp_[u]int_t where appropriate.Damien George
Addressing issue #50.
2014-09-23py: Free non-interned strings in the parser when not needed.Damien George
mp_parse_node_free now frees the memory associated with non-interned strings. And the parser calls mp_parse_node_free when discarding a non-used node (such as a doc string). Also, the compiler now frees the parse tree explicitly just before it exits (as opposed to relying on the caller to do this). Addresses issue #708 as best we can.
2014-09-23stmhal: Initialise stack pointer correctly.Damien George
Stack is full descending and must be 8-byte aligned. It must start off pointing to just above the last byte of RAM. Previously, stack started pointed to last byte of RAM (eg 0x2001ffff) and so was not 8-byte aligned. This caused a bug in combination with alloca. This patch also updates some debug printing code. Addresses issue #872 (among many other undiscovered issues).
2014-08-30py: Change uint to mp_uint_t in runtime.h, stackctrl.h, binary.h.Damien George
Part of code cleanup, working towards resolving issue #50.
2014-08-30py: Change all uint to mp_uint_t in obj.h.Damien George
Part of code cleanup, working towards resolving issue #50.
2014-08-30py: Make tuple and list use mp_int_t/mp_uint_t.Damien George
Part of code cleanup, to resolve issue #50.
2014-07-28py: Implement __file__ attribute for modules.Paul Sokolovsky
2014-06-11py: Make 3 functions static.Damien George
2014-06-07- FreeBSD provides alloca() via stdlib.h, in contrast to Linux and WindowsMarcus von Appen
- Move the includes for alloca() intp mpconfigport.h
2014-06-06Change comments (mainly URLs) to no longer specifically say Python 3.3Chris Angelico
2014-06-05objstr: Implement "%(key)s" % {} formatting for strings and dicts.Paul Sokolovsky
Also, make sure that args to "*" format specifiers are bounds-checked properly and don't lead for segfaults in case of mismatch.
2014-05-25Change const byte* to const char* where sensible.Damien George
This removes need for some casts (at least, more than it adds need for new casts!).
2014-05-24Rename configuration variables controling Python features.Damien George
Now of the form MICROPY_PY_*. See issue #35.
2014-05-21Tidy up some configuration options.Damien George
MP_ALLOC_* -> MICROPY_ALLOC_* MICROPY_PATH_MAX -> MICROPY_ALLOC_PATH_MAX MICROPY_ENABLE_REPL_HELPERS -> MICROPY_HELPER_REPL MICROPY_ENABLE_LEXER_UNIX -> MICROPY_HELPER_LEXER_UNIX MICROPY_EXTRA_* -> MICROPY_PORT_* See issue #35.
2014-05-13py, unix: Add copyright for modules I worked closely on.Paul Sokolovsky
2014-05-10builtinimport: Fix broken namespace imports due to dup vstr_cut_tail_bytes().Paul Sokolovsky
2014-05-10builtinimport: Fix comment orphaned by one of previous commits.Paul Sokolovsky
2014-05-03Add license header to (almost) all files.Damien George
Blanket wide to all .c and .h files. Some files originating from ST are difficult to deal with (license wise) so it was left out of those. Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
2014-05-03py: Use <alloca.h> for alloca()stijn
alloca() is declared in alloca.h which als happens to be included by stdlib.h. On mingw however it resides in malloc.h only. So if we include alloca.h directly, and add an alloca.h for mingw in it's port directory we can get rid of the mingw-specific define to include malloc.h and the other ports are happy as well.
2014-05-02py, unix: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky
Specifically, nlr.h does.
2014-04-22builtinimport: If there was error compiling imported module, raise exception.Paul Sokolovsky
2014-04-20py: Add win32-specific header for alloca().Paul Sokolovsky
2014-04-15builtinimport: Add basic support for namespace packages.Paul Sokolovsky
That was easy - just avoid erroring out on seeing candidate dir for namespace package. That's far from being complete though - namespace packages should support importing portions of package from different sys.path entries, here we require first matching entry to contain all namespace package's portions. And yet, that's a way to put parts of the same Python package into multiple installable package - something we really need for *Micro*Python.
2014-04-13py: Add more #if's for configurable MOD_SYS.Damien George
2014-04-13Merge pull request #476 from pfalcon/static-sysDamien George
Convert sys module to static allocation
2014-04-13py: Add traceback info to syntax errors.Damien George
Should fix issue #463.
2014-04-13py, unix: Convert sys module to static representation.Paul Sokolovsky
2014-04-12builtinimport: Implement relative imports.Paul Sokolovsky
2014-04-12builtinimport: Set __path__ attribute ASAP as it's clear we have a package.Paul Sokolovsky
This helps with handling "recursive" imports in sane manner, for example when foo/__init__.py has something like "from foo import submod".
2014-04-12builtinimport: Set __path__ attribute on packages.Paul Sokolovsky
Per https://docs.python.org/3.3/reference/import.html , this is the way to tell module from package: "Specifically, any module that contains a __path__ attribute is considered a package." And it for sure will be needed to implement relative imports.
2014-04-12builtinimport: Elaborate debug output support.Paul Sokolovsky
2014-04-09Remove exception name from inside the exception messageAndrew Scheller
This prevents micropython printing exception messages like ImportError: ImportError: No module named 'foo'
2014-04-06py: Add option to compiler to specify default code emitter.Damien George
Also add command line option to unix port to select emitter.
2014-04-05py: Make globals and locals proper dictionary objects.Damien George
Finishes addressing issue #424. In the end this was a very neat refactor that now makes things a lot more consistent across the py code base. It allowed some simplifications in certain places, now that everything is a dict object. Also converted builtins tables to dictionaries. This will be useful when we need to turn builtins into a proper module.
2014-04-05py: Change module globals from mp_map_t* to mp_obj_dict_t*.Damien George
Towards addressing issue #424. Had a small increase to ROM usage (order 60 bytes).
2014-04-05py: Change nlr_jump to nlr_raise, to aid in debugging.Damien George
This does not affect code size or performance when debugging turned off. To address issue #420.
2014-03-30Merge map.h into obj.h.Damien George
Pretty much everyone needs to include map.h, since it's such an integral part of the Micro Python object implementation. Thus, the definitions are now in obj.h instead. map.h is removed.
2014-03-30Rename rt_* to mp_*.Damien George
Mostly just a global search and replace. Except rt_is_true which becomes mp_obj_is_true. Still would like to tidy up some of the names, but this will do for now.
2014-03-25Proper support for registering builtin modules in ROM.Damien George
Comes with some refactoring of code and renaming of files. All modules are now named mod*.[ch].
2014-03-24py: Remove obsolete declarations; make mp_obj_get_array consistent.Damien George
2014-03-17py: Clean up includes.xbe
Remove unnecessary includes. Add includes that improve portability.
2014-03-15Add vstr_ins and vstr_cut_out; improve stmhal readline.Damien George
2014-02-21__import__: Catch relative import attempts and throw NotImplementedError.Paul Sokolovsky
2014-02-20import: Implement "from pkg.mod import sym" syntax properly.Paul Sokolovsky
http://docs.python.org/3.3/library/functions.html#__import__ : "When the name variable is of the form package.module, normally, the top-level package (the name up till the first dot) is returned, not the module named by name. However, when a non-empty fromlist argument is given, the module named by name is returned."
2014-02-16builtinimport: Get the basic (and only basic) package imports work.Paul Sokolovsky
2014-02-16builtinimport.c: Recognize "namespace package" and error out as unsupported.Paul Sokolovsky
See http://www.python.org/dev/peps/pep-0420/#specification for spec. See https://github.com/micropython/micropython/issues/298 for the discussion of the implemented behavior.
2014-02-15Implement proper exception type hierarchy.Damien George
Each built-in exception is now a type, with base type BaseException. C exceptions are created by passing a pointer to the exception type to make an instance of. When raising an exception from the VM, an instance is created automatically if an exception type is raised (as opposed to an exception instance). Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper. Handling of parse error changed to match new exceptions. mp_const_type renamed to mp_type_type for consistency.
2014-02-08Make mp_obj_str_get_data return char* instead of byte*.Damien George
Can't decide which is better for string type, char or byte pointer. Changing to char removes a few casts. Really need to do proper unicode.
2014-02-06Implement fixed buffer vstrs; use them for import path.Damien George
2014-02-05Search paths properly on import and execute __init__.py if it exists.Damien George