Paul Sokolovsky
d3783570a4
builtinimport.c: Recognize "namespace package" and error out as unsupported.
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.
11 years ago
Damien George
e5d371b545
py: Pass keyword arguments to byte code.
11 years ago
Damien George
2e482cdb7b
py: Implement *vargs support.
Addresses issue #295 .
11 years ago
Damien George
96056a6272
py: Revent some long int configuration.
11 years ago
Damien George
c8f78bc280
py: VM never throws an exception, instead returns a status and value.
Addresses issue #290 , and hopefully sets up things to allow generators
throwing exceptions, etc.
11 years ago
Paul Sokolovsky
ff4678c5b4
objexcept: Fix thinko with args to mp_obj_new_list().
First arg is not alloc size, but real size, so if used as
mp_obj_new_list(3, NULL), need to store items, not append.
11 years ago
Damien George
36109d246f
Small change to configuration of long int.
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
Damien George
a71c83a1d1
Change mp_obj_type_t.name from const char * to qstr.
Ultimately all static strings should be qstr. This entry in the type
structure is only used for printing error messages (to tell the type of
the bad argument), and printing objects that don't supply a .print method.
11 years ago
Damien George
aa9b74fead
py: Fix IMPORT_STAR, needs to pop the stack.
11 years ago
Paul Sokolovsky
76f8cedb52
mp_binary_get_val(): Fix value type.
11 years ago
Paul Sokolovsky
60a0d3f1db
objexcept: Fix a case of initialized object field.
11 years ago
Paul Sokolovsky
c203324e6c
objarray: Refactor to use array accessors from binary.c .
11 years ago
Paul Sokolovsky
8bc3516389
ffi: Implement ffivar.get()/set() methods.
Done by introducing another factored out helper API in binary.c. This API
can be reused also by array and struct modules.
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
Damien George
099a9cb575
Remove mp_obj_new_exception_msg_1_arg and _2_arg.
11 years ago
Paul Sokolovsky
2aa217b974
Implement full arg handling for exec().
11 years ago
Paul Sokolovsky
520e2f58a5
Replace global "static" -> "STATIC", to allow "analysis builds". Part 2.
11 years ago
Paul Sokolovsky
d5df6cd44a
Replace global "static" -> "STATIC", to allow "analysis builds". Part 1.
Some tools do not support local/static symbols (one example is GNU ld map file).
Exposing all functions will allow to do detailed size comparisons, etc.
Also, added bunch of statics where they were missing, and replaced few identity
functions with global mp_identity().
11 years ago
Paul Sokolovsky
550d804d95
Add prototype for gc_dump_info().
11 years ago
Paul Sokolovsky
723a6ed371
More GC debugging improvements.
11 years ago
Paul Sokolovsky
b62c30b4bc
Generalize malloc-via-gc-heap support, make it available to unix port.
11 years ago
Paul Sokolovsky
4e2460852a
objstr: Mark few local symbols as static, cleanup codestyle.
Please don't submit patches with tab indentation!
11 years ago
Paul Sokolovsky
c0a8374103
gc: Don't segfault if gc_realloc() fails.
11 years ago
Paul Sokolovsky
af19cbd201
gc: Make debug output configurable, revamp test function.
Test function needs to be called by something else. Test heap size reduced so
its dump fits on a screenful of a typical terminal.
11 years ago
Paul Sokolovsky
4e836fb4ea
mp_obj_equal(): Instead of assert(), throw NotImplementedError.
With a nice traceback, helps debugging much better.
11 years ago
Paul Sokolovsky
0a25aba046
Typo fix in comment.
11 years ago
Damien George
d46ca25757
Fix some int casting that failed on 64 bit architecture.
11 years ago
Paul Sokolovsky
58ff93bc7c
Get rid of calloc().
If there's malloc and memset, then there's no need for calloc, especially if
we need to implement it ourselves.
11 years ago
Paul Sokolovsky
ac0134d427
Factor out mp_seq_count_obj() and implement tuple.count().
11 years ago
Paul Sokolovsky
624eff6a8a
Implement tuple.index().
11 years ago
Paul Sokolovsky
0cd1dc06e6
Factor out mp_seq_index_obj() function to implement .index() on sequences.
11 years ago
Paul Sokolovsky
2f0b026a44
Clean up handling of function return type annotation.
11 years ago
Paul Sokolovsky
76f06de96d
Add NotImplementedError.
11 years ago
Paul Sokolovsky
f7c2410e65
Implement tuple multiplication.
11 years ago
Paul Sokolovsky
ee4aaf7cdd
Implement tuple addition.
11 years ago
Paul Sokolovsky
e827e98a6f
Implement tuple comparison.
11 years ago
Paul Sokolovsky
1a996c48ac
Refactor list comparison code to mp_seq_cmp_objs().
11 years ago
Paul Sokolovsky
557c9d5264
unix microsocket: Add dummy makefile() method.
Unlike CPython socket, microsocket object already implements stream protocol
(read/write methods), so makefile() just returns object itself. TODO: this
doesn't take care of arguments CPython's makefile() may accept.
11 years ago
Damien George
7d0bfbedd2
py: Add some qstrs to the global table.
11 years ago
Damien George
0a587b85fb
py: Pass keyword args to native functions by using the stack.
Passing keyword arguments to a native function now no longer requires
heap memory. The kw_args map is created on the stack using the args
array as the table.
11 years ago
Damien George
9a58d760c3
py: Allow mp_map_t to be initialised by a fixed-size, const table.
This allows keyword maps to be created directly from stack data.
11 years ago
Damien George
698ec21e46
Make mp_obj_str_get_data return char* instead of byte*.
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.
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
354d15a964
Implement fixed buffer vstrs; use them for import path.
11 years ago
Damien George
64131f3215
Add staticmethod and classmethod to builtin namespace.
11 years ago
Damien George
ddaf6c112c
py: More output in showbc.
11 years ago