summaryrefslogtreecommitdiffstatshomepage
path: root/py/builtinimport.c
Commit message (Collapse)AuthorAge
* Make mp_obj_str_get_data return char* instead of byte*.Damien George2014-02-08
| | | | | 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.
* Implement fixed buffer vstrs; use them for import path.Damien George2014-02-06
|
* Search paths properly on import and execute __init__.py if it exists.Damien George2014-02-05
|
* Implement support for sys.path when loading modules.Paul Sokolovsky2014-02-05
| | | | | | | | sys.path is not initialized by rt_init(), that's left for platform-specific startup code. (For example, bare metal port may have some hardcoded defaults, and let user change sys.path directly; while port for OS with environment feature can take path from environment). If it's not explicitly initialized, modules will be imported only from a current directory.
* Expose __import__() function.Paul Sokolovsky2014-02-04
|
* Implement mp_parse_node_free; print properly repr(string).Damien George2014-01-25
|
* Second stage of qstr revamp: uPy str object can be qstr or not.Damien George2014-01-22
|
* Revamp qstrs: they now include length and hash.Damien George2014-01-21
| | | | | Can now have null bytes in strings. Can define ROM qstrs per port using qstrdefsport.h
* Implement modules as singletons Python semantics.Paul Sokolovsky2014-01-20
| | | | | | | | | | | | In Python, importing module several times returns same underlying module object. This also fixes import statement handling for builtin modules. There're still issues: 1. CPython exposes set of loaded modules as sys.modules, we may want to do that either. 2. Builtin modules are implicitly imported, which is not really correct. We should separate registering a (builtin) module and importing a module. CPython keeps builtin module names in sys.builtin_module_names .
* Add source file name and line number to error messages.Damien George2014-01-18
| | | | | Byte code has a map from byte-code offset to source-code line number, used to give better error messages.
* Convert parse errors to exceptions.Damien George2014-01-15
| | | | | Parser no longer prints an error, but instead returns an exception ID and message.
* Cleanup built-ins, and fix some compiler warnings/errors.Damien George2014-01-13
|
* Split qstr into pools, and put initial pool in ROM.Damien George2014-01-04
| | | | | | | | | | | | | | | | Qstr's are now split into a linked-list of qstr pools. This has 2 benefits: the first pool can be in ROM (huge benefit, since we no longer use RAM for the core qstrs), and subsequent pools use m_new for the next pool instead of m_renew (thus avoiding a huge single table for all the qstrs). Still would be better to use a hash table, but this scheme takes us part of the way (eventually convert the pools to hash tables). Also fixed bug with import. Also improved the way the module code is referenced (not magic number 1 anymore).
* Change mp_compile so that it returns a function object for the module.Damien George2014-01-03
|
* Basic implementation of import.Damien George2014-01-03
import works for simple cases. Still work to do on finding the right script, and setting globals/locals correctly when running an imported function.