Paul Sokolovsky
6ead0d2fbc
objtype: Implement basic framework for subclassing native types.
This implements checking of base types, allocation and basic initialization,
and optimized support for special method lookups. Other features are not yet
supported.
11 years ago
Damien George
186e463a9e
py: Fix bug in map lookup of interned string vs non-interned.
Had choice of either interning or forcing full equality comparison, and
chose latter. See comments in mp_map_lookup.
Addresses issue #523 .
11 years ago
Damien George
185f9c1c46
py: Fix lexerunix, where not all data may be read from a file.
Addresses issue #526 .
11 years ago
Damien George
0c8fcb9c49
py: Remove silly comment about interning keywords.
Of course, keywords are turned into lexer tokens in the lexer, so will
never need to be interned (unless you do something like x="def").
As it is now, the following on pyboard makes no new qstrs:
import pyb
pyb.info()
11 years ago
Paul Sokolovsky
a224067846
py: Clear allocated, but unused memory in containers.
Also, clear up freed slots in containers.
As a follow up to 32bef315be
.
11 years ago
Paul Sokolovsky
7ce6a8fe46
objlist: We no longer need to assert on mem alloc results.
They either succeed or raise exception.
11 years ago
Paul Sokolovsky
48bf6b3bd0
objlist: Use static small int constructor.
11 years ago
Damien George
708c073250
py: Add '*' qstr for 'import *'; use blank qstr for comprehension arg.
11 years ago
Damien George
968bf34c4c
py: Remove unnecessary LOAD_CONST_ID bytecode.
It's the same as LOAD_CONST_STR.
11 years ago
Damien George
db12891918
py: Eliminate 'op' variable in VM dispatch loop.
Remembering the last op is rarely needed, and when it is, can simply use
*save_ip.
11 years ago
Damien George
9d181f62dc
py: Save some ROM by shortening compiler error messages.
Messages are still explanatory, while taking a little less ROM.
11 years ago
Damien George
2c0842b3c5
py: Change the way function arguments are compiled.
New way uses slightly less ROM and RAM, should be slightly faster, and,
most importantly, allows to catch the error "non-keyword arg following
keyword arg".
Addresses issue #466 .
11 years ago
Damien George
2827d62e8b
py: Implement keyword-only args.
Implements 'def f(*, a)' and 'def f(*a, b)', but not default
keyword-only args, eg 'def f(*, a=1)'.
Partially addresses issue #524 .
11 years ago
Damien George
36cbd0db7e
Merge branch 'master' of github.com:micropython/micropython
11 years ago
Damien George
32bef315be
py, gc: Only zero out the extra bytes at the end of the heap chunk.
This is a small optimisation to zero out only the additional bytes that
the caller did not ask for.
11 years ago
Paul Sokolovsky
27f5bdd6d4
py: "read" & "write" are so common that make them core.
Few other strings move to core, but make depend on "io" module.
11 years ago
Paul Sokolovsky
100cd36a0e
objstringio: Compile only if MICROPY_ENABLE_MOD_IO defined.
11 years ago
Paul Sokolovsky
cb9dc086a3
modio: Implement io.StringIO class.
11 years ago
Damien George
dbc81df5d4
Simplify names for argcheck.c / arg parsing.
11 years ago
Damien George
6d3c5e4301
Add ARRAY_SIZE macro, and use it where possible.
11 years ago
Damien George
d139c489ba
Merge branch 'master' of github.com:micropython/micropython
11 years ago
Damien George
6cebe24b7d
bare-arm: Disable more stuff to reduce binary size.
11 years ago
Damien George
107c9fb235
py: Make collections module configurable, enabled by default.
11 years ago
Paul Sokolovsky
e14d096cb7
objstr: Optimize .rstrip() by scanning string from end.
11 years ago
Paul Sokolovsky
881078403e
objstr: Implement .lstrip() & .rstrip().
Share code with .strip(). TODO: optimize .rstrip().
11 years ago
Paul Sokolovsky
12a9cfed76
modsocket: Make .send() support arbitrary objects with buffer interface.
This is CPython-compliant (except that CPython doesn't support buffer
protocol for str).
11 years ago
Paul Sokolovsky
45fb143ba6
streams: Make .write() support arbitrary objects with buffer interface.
This in particular fixes writing str vs bytes.
11 years ago
Damien George
1463c1fa82
py: Add MICROPY_ENABLE_DOC_STRING, disabled by default.
Also add a few STATIC's to some compile functions that should have them.
Addresses issue #521 .
11 years ago
Damien George
c492cf1f44
Merge branch 'master' of github.com:micropython/micropython
11 years ago
Damien George
daab651c5c
py, gc: Zero out newly allocated blocks in the GC.
Also add some more debugging output to gc_dump_alloc_table().
Now that newly allocated heap is always zero'd, maybe we just make this
a policy for the uPy API to keep it simple (ie any new implementation of
memory allocation must zero all allocations). This follows the D
language philosophy.
Before this patch, a previously used memory block which had pointers in
it may still retain those pointers if the new user of that block does
not actually use the entire block. Eg, if I want 5 blocks worth of
heap, I actually get 8 (round up to nearest 4). Then I never use the
last 3, so they keep their old values, which may be pointers pointing to
the heap, hence preventing GC.
In rare (or maybe not that rare) cases, this leads to long, unintentional
"linked lists" within the GC'd heap, filling it up completely. It's
pretty rare, because you have to reuse exactly that memory which is part
of this "linked list", and reuse it in just the right way.
This should fix issue #522 , and might have something to do with
issue #510 .
11 years ago
Paul Sokolovsky
755565d2cb
py: Support instance __call__ method.
11 years ago
Damien George
410f30772f
py, gc: Fix old gc_realloc for case when NULL is passed in as ptr.
11 years ago
Damien George
5be40afb4c
Merge pull request #515 from errordeveloper/qemu
Qemu
11 years ago
Damien George
c0dc7c3dfa
py, vm: Fix recent bug where state is freed too early.
11 years ago
Damien George
d5e8482c4a
py, vm: Free heap-allocated state if it was allocated on the heap.
11 years ago
Damien George
978939156d
Merge pull request #519 from pfalcon/exc-no-ptr-to-field
objexcept: Don't store args tuple within exception object.
11 years ago
Damien George
1cbb99d1db
Merge pull request #518 from pfalcon/vm-trace
vm: Add rudimentary bytecode execution tracing capability.
11 years ago
Paul Sokolovsky
1c1d902cd3
Makefile: Allow to override "super optimization" options used for some files.
To help with debugging issue like #510 for example.
11 years ago
Paul Sokolovsky
6c94abe347
windows/README: Use CROSS_COMPILE instead of CC to cover other tools too.
Suggested by @lurch .
11 years ago
Paul Sokolovsky
1acf22f17b
objexcept: Don't store args tuple within exception object.
To avoid pointer-to-field GC problem.
11 years ago
Paul Sokolovsky
c5e32c6995
vm: Add rudimentary bytecode execution tracing capability.
11 years ago
Paul Sokolovsky
4c6b375960
showbc: MAKE_CLOSURE*: Update for new closed-over encoding.
11 years ago
Paul Sokolovsky
5e3e2d00ea
emitglue: Typo fix in var name.
11 years ago
Paul Sokolovsky
20e9ed3916
builtinimport: If there was error compiling imported module, raise exception.
11 years ago
Paul Sokolovsky
fa6f0506c1
unix: Workaround MP_OBJ_NEW_SMALL_INT() 64-bit issues.
11 years ago
Paul Sokolovsky
5d3a830171
modsocket: Clean up OSError-like exception a bit.
Some BSD socket functions don't return error numbers in errno namespace, but
rather in other error namespaces. CPython resolves this by using OSError
subclasses for them. We don't do that so far, so there's ambiguity here.
11 years ago
Paul Sokolovsky
acb13886fc
unix: OSError's args[0] should be errno numeric value.
Well, Python3 also defines an attribute for that, but that's bloat.
11 years ago
Paul Sokolovsky
dec31bb872
objexcept: Add mp_obj_new_exception_arg1() convenience function.
11 years ago
Paul Sokolovsky
b418b6fb0d
modffi: Don't use OSError for clearly unrelated errors.
11 years ago
Paul Sokolovsky
88972b0d94
modffi: Describe typecodes where they differ from used by struct module.
Exact behavior of typecodes may be not yet enforced.
11 years ago