Damien George
5042bce8fb
py: Don't automatically intern strings in parser.
This completes non-automatic interning of strings in the parser, so that
doc strings don't take up RAM. It complicates the parser and compiler,
and bloats stmhal by about 300 bytes. It's complicated because now
there are 2 kinds of parse-nodes that can be strings: interned leaves
and non-interned structs.
11 years ago
Paul Sokolovsky
5fd5af98d0
objlist: Implement support for arbitrary (3-arg) slices.
11 years ago
Paul Sokolovsky
de4b9329f9
py: Refactor slice helpers, preparing to support arbitrary slicing.
11 years ago
Paul Sokolovsky
ff4b6daa4f
sequence: Throw exception for not implemented slice steps.
11 years ago
Paul Sokolovsky
2705f4c782
objlist: Implement growing slice assignment.
This means that complete slice operations are supported for lists (but not
for bytearray's and array.array's).
11 years ago
Paul Sokolovsky
69d081a7cf
py: Handle case of slice start > stop in common sequence function.
11 years ago
Paul Sokolovsky
afaaf535e6
objslice: Support arbitrary objects start, stop, and step.
Older int-only encoding is not expressive enough to support arbitrary slice
assignment operations.
11 years ago
Damien George
7a4ddd2428
Add SystemExit exception and use it in unix/ and stmhal/ ports.
Addresses issue #598 .
11 years ago
Damien George
ee3fd46f13
Rename configuration variables controling Python features.
Now of the form MICROPY_PY_*. See issue #35 .
11 years ago
Paul Sokolovsky
d098c6bf85
objstr: Implement .endswith().
11 years ago
Paul Sokolovsky
561789d718
unix modsocket: Make .makefile() method more compliant.
.makefile() should allow to specify which stream time to create - byte
or text.
11 years ago
Paul Sokolovsky
806ea1f6ca
py: Initial attempts to actually allow implementing __new__ in Python.
Caveat is that __new__ should recurse to base class __new__, and ultimately,
object.__new__ is what handles instance allocation.
11 years ago
Paul Sokolovsky
0c937fa25a
objobject: Fix arguments to __init__().
11 years ago
Damien George
58ebde4664
Tidy up some configuration options.
MP_ALLOC_* -> MICROPY_ALLOC_*
MICROPY_PATH_MAX -> MICROPY_ALLOC_PATH_MAX
MICROPY_ENABLE_REPL_HELPERS -> MICROPY_HELPER_REPL
MICROPY_ENABLE_LEXER_UNIX -> MICROPY_HELPER_LEXER_UNIX
MICROPY_EXTRA_* -> MICROPY_PORT_*
See issue #35 .
11 years ago
Paul Sokolovsky
a8408a8abe
objtype: super: Fall back to "object" lookup as last resort.
Also, define object.__init__() (semantically empty, purely CPython compat
measure). Addresses #520 .
11 years ago
Paul Sokolovsky
6a410789b8
objtype: super: Add stop condition for looking up in base types.
11 years ago
Damien George
6ac5dced24
py: Rename MP_OBJ_NOT_SUPPORTED to MP_OBJ_NULL.
See issue #608 for justification.
11 years ago
Paul Sokolovsky
053765414c
modstruct: struct_calcsize: Fix case of uninitialized var.
11 years ago
Paul Sokolovsky
9e29666bf9
py: Implement proper separation between io.FileIO and io.TextIOWrapper.
io.FileIO is binary I/O, ans actually optional. Default file type is
io.TextIOWrapper, which provides str results. CPython3 explicitly describes
io.TextIOWrapper as buffered I/O, but we don't have buffering support yet
anyway.
11 years ago
Paul Sokolovsky
52386cafa0
objexcept: Implement explicit __init__ method, useful for subclasses.
11 years ago
Paul Sokolovsky
13684fd60b
objtype: Separate __new__ and __init__ methods.
Now schedule is: for native types, we call ->make_new() C-level method, which
should perform actions of __new__ and __init__ (note that this is not
compliant, but is efficient), but for user types, __new__ and __init__ are
called as expected.
Also, make sure we convert scalar attribute value to a bound-pair tight in
mp_obj_class_lookup() method, which avoids converting it again and again in
its callers.
11 years ago
Sven Wegener
7ba0fedf13
py: Fix mp_obj_t -> mp_const_obj_t for mp_obj_int_get_checked()
Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
11 years ago
Paul Sokolovsky
bf27140193
py: More mp_identity usage.
11 years ago
Paul Sokolovsky
ab7bf28489
py: More const usage.
11 years ago
Paul Sokolovsky
c18ef2a9dd
objstr: startswith(): Accept optional "start" arg.
11 years ago
Paul Sokolovsky
70328e419a
py: Implement more complete bytes comparison handling.
11 years ago
Paul Sokolovsky
ad3baec12f
sequence: Fix yet another case of improper sequence comparison.
This time, in mp_seq_cmp_bytes(). How many more cases are still lurking?
11 years ago
Paul Sokolovsky
a47b64ae2d
objstringio: Implement io.BytesIO.
Done in generalized manner, allowing any stream class to be specified as
working with bytes.
11 years ago
Paul Sokolovsky
2a27365854
objstr.c: Partial implementation of .rsplit().
sep=None is TODO.
11 years ago
Damien George
51fab28e94
py: Improve mpz_and function.
This should now have correct (and optimal) behaviour.
11 years ago
Paul Sokolovsky
da9f0924ef
py, unix: Add copyright for modules I worked closely on.
11 years ago
Damien George
561e425903
py: Fix bug in mpz_and function.
Addresses issue #610 .
11 years ago
Damien George
915197a8f9
py: Remove emit_glue init and deinit. Needed only for debugging.
Debugging output for emit_glue now simplified so that the init and
deinit functions are no longer needed.
11 years ago
Damien George
97f9a2813e
py: Add support for __debug__ constant.
__debug__ now resolves to True or False. Its value needs to be set by
mp_set_debug().
TODO: call mp_set_debug in unix/ port.
TODO: optimise away "if False:" statements in compiler.
11 years ago
Damien George
96f137b24a
py: Rename BYTE_CODE to BYTECODE (this was missed in previous rename).
11 years ago
Paul Sokolovsky
df94b717b4
modstruct: Implement count specifier for strings (e.g. "100s").
Infra for counts of other types is there, need last mile to be implemented.
11 years ago
Antonin ENFRUN
da1fffaa09
Fix some unused variables, and silence a clang warning about initialization override in vmentrytable.h
11 years ago
Antonin ENFRUN
6caae0bcb1
unix: Create __bss_start and _end symbols for Mach-O targets.
It's a hack, but can't find a cleaner way to do it.
11 years ago
Paul Sokolovsky
147c80bf7c
modstruct: Use MP_OBJ_FUN_ARGS_MAX instead of -1.
11 years ago
Paul Sokolovsky
5ebd5f0f19
objstr: Slice indexing: support bytes properly.
11 years ago
Paul Sokolovsky
bfb8819c0c
objstr: Make .split() support bytes.
11 years ago
Paul Sokolovsky
5e5d69b35e
objstr: Make .join() support bytes.
11 years ago
Paul Sokolovsky
7e7940c39d
py: Fix __len__ special method result handling.
Having both MP_OBJ_NOT_SUPPORTED and MP_OBJ_NULL is arguably confusing.
11 years ago
Paul Sokolovsky
c48d6f7add
py: Don't expect that type->getiter() always returns iterator, check for NULL.
This is better than forcing each getiter() implementation to raise exception.
11 years ago
Paul Sokolovsky
0f570cfccf
showbc: Decode MAP_ADD.
11 years ago
Paul Sokolovsky
ff30666c69
py: Add basic implementation of hasattr() function.
11 years ago
Damien George
ee7a880d6e
py: Use mp_arg_check_num in more places.
Updated functions now do proper checking that n_kw==0, and are simpler
because they don't have to explicitly raise an exception. Down side is
that the error messages no longer include the function name, but that's
acceptable.
Saves order 300 text bytes on x64 and ARM.
11 years ago
Damien George
1d34e32431
py: frozenset() creates an empty frozenset.
11 years ago
Damien George
2323ef9182
py: Rename globally-accessible tuple functions, prefix with mp_obj_.
Likely there are other functions that should be renamed, but this is a
start.
11 years ago
Damien George
c59af52e84
py: Rename some unichar functions for consistency.
11 years ago