| Commit message (Collapse) | Author | Age |
... | |
| |
|
|
|
|
|
| |
Takes slice object and sequence length and computes subsequence indexes
for case of slice step=1.
|
|
|
|
|
|
|
|
| |
TODO: Decide if we really need separate bytecode for creating functions
with default arguments - we would need same for closures, then there're
keywords arguments too. Having all combinations is a small exponential
explosion, likely we need just 2 cases - simplest (no defaults, no kw),
and full - defaults & kw.
|
|
|
|
|
|
|
|
|
|
| |
We still have FAST_[0,1,2] byte codes, but they now just access the
fastn array (before they had special local variables). It's now
simpler, a bit faster, and uses a bit less stack space (on STM at least,
which is most important).
The only reason now to keep FAST_[0,1,2] byte codes is for compressed
byte code size.
|
|
|
|
| |
This is special feature for FFI.
|
| |
|
| |
|
| |
|
|
|
|
| |
Addresses Issue #203.
|
|
|
|
|
| |
This reuses as much str implementation as possible, from this we
can make them more separate as needed.
|
| |
|
| |
|
| |
|
|
|
|
| |
Useful as getiter method for objects which are their own iterators, etc.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 .
|
| |
|
| |
|
|
|
|
|
|
|
| |
Exceptions know source file, line and block name.
Also tidy up some debug printing functions and provide a global
flag to enable/disable them.
|
|\
| |
| | |
Add skeleton implementation of array.array and bytearray.
|
| |
| |
| |
| |
| | |
So far, only storage, initialization, repr() and buffer protocol is
implemented - alredy suitable for passing binary data around.
|
|/
|
|
|
| |
Byte code has a map from byte-code offset to source-code line number,
used to give better error messages.
|
|\
| |
| | |
Add store_item() virtual method to type to implement container[index] = val
|
| | |
|
|\ \ |
|
| |/
| |
| |
| |
| |
| | |
mp_obj_int_get() can be used when just full resolution of C machine_int_t
is required (returns truncated value of long int). mp_obj_int_get_checked()
will throw exception if Python int value not representable in machine_int_t.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change state layout in VM so the stack starts at state[0] and grows
upwards. Locals are at the top end of the state and number downwards.
This cleans up a lot of the interface connecting the VM to C: now all
functions that take an array of Micro Python objects are in order (ie no
longer in reverse).
Also clean up C API with keyword arguments (call_n and call_n_kw
replaced with single call method that takes keyword arguments). And now
make_new takes keyword arguments.
emitnative.c has not yet been changed to comply with the new order of
stack layout.
|
| |
|
|\
| |
| |
| |
| |
| |
| | |
Conflicts:
py/objint.c
unix-cpy/Makefile
unix/Makefile
|
| | |
|
|\ \
| | |
| | |
| | |
| | | |
Conflicts:
tests/basics/tests/exception1.py
|
| | | |
|
| | | |
|
| | | |
|
|\| | |
|
| | | |
|
|/ / |
|
| |
| |
| |
| | |
arguments; moved around some things in objfun.c as a consequence
|
| | |
|
| | |
|
| | |
|
|/
|
|
|
|
|
| |
We likely should make mp_obj_new_int() inline, and rely on its
encapsulated check rather than inline checks everywhere explicitly.
Also, parser for big small int values is still broken.
|
|
|
|
| |
Still need to make built-ins by these names, and write tests.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Creating of classes (types) and instances is much more like CPython now.
You can use "type('name', (), {...})" to create classes.
|
|
|
|
| |
Addresses issue #104.
|
|\
| |
| | |
Define buffer and stream protocols, and other starting bits of io.* framework, with io.FileIO-like implementation for Unix
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Stream protocol is abstraction of serial I/O. Buffer protocol is
abstraction of random-access I/O. These protocols are defined down
to C level, to allow generic, while still efficient algorithms
to be coded in C (like, buffered transfer between 2 stream objects,
saving/loading of buffer object to/from stream, etc). (Note that CPython
define buffer protocol on C level, but apparently not stream protocol).
|