Damien George
c12b2213c1
Change mp_method_t.name from const char * to qstr.
Addresses issue #377 .
11 years ago
Damien George
66eaf84b8c
py: Replace mp_const_stop_iteration object with MP_OBJ_NULL.
11 years ago
Damien George
9e6e935df0
py: Add support for user-defined iterators via __iter__, __next__.
11 years ago
Damien George
caac542b23
Proper support for registering builtin modules in ROM.
Comes with some refactoring of code and renaming of files. All modules
are now named mod*.[ch].
11 years ago
Paul Sokolovsky
7f8b31345b
rt_load_method(): Add missing qstr_str() when getting type name.
11 years ago
Paul Sokolovsky
f909034400
py: Implement support for "except Exception as var" clause.
For this, needed to implement DELETE_NAME bytecode (because var bound
in except clause is automatically deleted at its end).
http://docs.python.org/3/reference/compound_stmts.html#except :
"When an exception has been assigned using as target, it is cleared at
the end of the except clause."
11 years ago
Paul Sokolovsky
4b2b7ceca7
runtime: RT_BINARY_OP_EXCEPTION_MATCH: don't fall thru in case of wrong types.
11 years ago
Damien George
c91097223d
py: Remove some unnecessary exception objects.
11 years ago
Damien George
3ec0a1a32d
py: Add 'object' object.
11 years ago
Rachel Dowdall
2d15deebdc
Fixed floor division on mp ints and small ints. Added a floordivide test case.
11 years ago
Rachel Dowdall
56402796d8
Fixed floor division on mp ints and small ints. Added a floordivide test case.
11 years ago
Rachel Dowdall
cde8631f15
Fixed modulo operator on ints and mp ints to agree with python. Added intdivmod.c and tests/basics/modulo.py.
11 years ago
Rachel Dowdall
721c55dced
Added exception hierarchy except for OSError and UnicodeError (requires arguments). Comment out the errors that aren't needed if memory becomes an issue.
11 years ago
Paul Sokolovsky
1ecea7c753
py: Make 'bytes' be a proper type, support standard constructor args.
11 years ago
Paul Sokolovsky
be020c27a8
py: Make 'str' be a proper type, support standard constructor args.
11 years ago
Damien George
6e48f7fa85
py: Allow 'complex()' to take a string as first argument.
11 years ago
Damien George
c06ea7abf2
py: Implement parsing of infinity and nan for floats.
11 years ago
Rachel Dowdall
300c8bd4c2
Added ZeroDivisionError to float division.
11 years ago
xbe
efe3422394
py: Clean up includes.
Remove unnecessary includes. Add includes that improve portability.
11 years ago
Damien George
9d68e9ccdd
py: Implement integer overflow checking for * and << ops.
If operation will overflow, a multi-precision integer is created.
11 years ago
Damien George
0ec6bd47cb
py: Fix printing of type name.
11 years ago
Damien George
0c36da0b59
Implement ROMable modules. Add math module.
mp_module_obj_t can now be put in ROM.
Configuration of float type is now similar to longint: can now choose
none, float or double as the implementation.
math module has basic math functions. For STM port, these are not yet
implemented (they are just stub functions).
11 years ago
Damien George
715101580b
py: Factor and improve issubclass.
11 years ago
Paul Sokolovsky
d08fd68664
Add basic collections.namedtuple implementation.
11 years ago
Damien George
41eb6086b7
py: Remove more var arg names fro macros with var args.
11 years ago
Damien George
510477557d
py: Take out bitfield entries from their own structure.
Don't need to wrap bitfields in their own struct. Compiler does the
correct thing without it.
11 years ago
Damien George
2077397118
py: Put number parsing code together in parsenum.c.
11 years ago
Paul Sokolovsky
ac2e28c654
Support passing positional args as keywords to bytecode functions.
For this, record argument names along with each bytecode function. The code
still includes extensive debug logging support so far.
11 years ago
Paul Sokolovsky
44739e280e
Make DEBUG_printf() a proper function, implementation is port-dependent.
In particular, unix outputs to stderr, to allow to run testsuite against
micropython built with debug output (by redirecting stderr to /dev/null).
11 years ago
Damien George
2e482cdb7b
py: Implement *vargs support.
Addresses issue #295 .
11 years ago
Damien George
22a0865d54
py: Improve exception bases, reduces ROM usage.
Thanks to @pfalcon for the tip!
11 years ago
Damien George
8725f8f7de
py: Pass all scope flags through to runtime.
11 years ago
Damien George
c5966128c7
Implement proper exception type hierarchy.
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.
11 years ago
Paul Sokolovsky
910843e86d
Allow ports to define statically builtin functions.
Convert unix open() to such.
11 years ago
Paul Sokolovsky
da1ce93da8
Implement "from module import *" construct.
11 years ago
Paul Sokolovsky
520e2f58a5
Replace global "static" -> "STATIC", to allow "analysis builds". Part 2.
11 years ago
Paul Sokolovsky
76f06de96d
Add NotImplementedError.
11 years ago
Damien George
7d0bfbedd2
py: Add some qstrs to the global table.
11 years ago
Damien George
aea532ece1
py: Put builtins into ROM table.
Linear table at the moment, to eventually be replaced with a hash table
generated by a preprocessor.
Dynamic table is retained so that builtins can be overridden.
11 years ago
Damien George
64131f3215
Add staticmethod and classmethod to builtin namespace.
11 years ago
Damien George
35e2a4e6bb
py: Add built-in super.
11 years ago
Paul Sokolovsky
e11b17c25f
Implement support for sys.path when loading modules.
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.
11 years ago
Paul Sokolovsky
0c59db1973
Use qstr id to create sys module.
11 years ago
Paul Sokolovsky
7cd54d79db
Add ImportError.
11 years ago
Paul Sokolovsky
1d938c9503
Expose __import__() function.
11 years ago
Damien George
ca4767984b
py: Implement builtin exec.
11 years ago
Damien George
4acb2452b3
py: Add very basic implementation of dir() builtin.
Only works on modules and class instances.
11 years ago
Damien George
cd82e02e84
py: Partially fix native emitter to work with latest runtime.
Native emitter has been broken since stack order has changed from
reverse to standard. This fix gets it partially working.
11 years ago
xbe
0ebf8534ab
Implement and add tests for the id() builtin function.
11 years ago
Paul Sokolovsky
edbdf71f5c
rt_unpack_sequence(): Support generic iterables.
11 years ago