Paul Sokolovsky
52386cafa0
objexcept: Implement explicit __init__ method, useful for subclasses.
2014-05-19 21:56:07 +03:00
Paul Sokolovsky
66ab571cca
tests: Update subclass-native2.py for __new__/__init__ refactor.
...
Now case of subclassing tuple works, and list is broken, see comments.
2014-05-19 21:56:07 +03:00
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.
2014-05-19 21:56:06 +03:00
Damien George
eee31288dd
stmhal: Fix DAC documentation: need to convert float to int for buf.
2014-05-19 19:08:12 +01:00
Damien George
2de4d59171
stmhal: Fix write_timed function for DAC(2).
...
Addresses issue #617 .
2014-05-19 18:58:53 +01:00
Damien George
f905ebb173
stmhal: Make pyb.bootloader take no arguments.
2014-05-19 18:26:51 +01:00
Damien George
404f7cf902
Merge pull request #618 from swegener/jump-to-bootloader
...
Jump to bootloader
2014-05-19 18:13:34 +01:00
Sven Wegener
9bf4f7e3d3
stmhal: Remap system flash and adjust addresses
...
Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2014-05-18 13:15:02 +02:00
Sven Wegener
7ae8e4b679
stmhal: Activate bootloader with pyb.bootloader()
...
Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2014-05-18 12:51:21 +02:00
Paul Sokolovsky
5cdff5fa61
Merge pull request #615 from swegener/for-upstream
...
py: Fix mp_obj_t -> mp_const_obj_t for mp_obj_int_get_checked()
2014-05-17 23:30:00 +03:00
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>
2014-05-17 11:21:12 +02:00
Paul Sokolovsky
bf27140193
py: More mp_identity usage.
2014-05-17 11:20:10 +03:00
Paul Sokolovsky
ab7bf28489
py: More const usage.
2014-05-17 11:20:10 +03:00
Paul Sokolovsky
c18ef2a9dd
objstr: startswith(): Accept optional "start" arg.
2014-05-15 21:33:18 +03:00
Paul Sokolovsky
70328e419a
py: Implement more complete bytes comparison handling.
2014-05-15 20:58:40 +03:00
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?
2014-05-15 19:09:06 +03:00
Paul Sokolovsky
767e45c290
modos: Clean 64-bit issues.
2014-05-15 18:38:54 +03:00
Paul Sokolovsky
a47b64ae2d
objstringio: Implement io.BytesIO.
...
Done in generalized manner, allowing any stream class to be specified as
working with bytes.
2014-05-15 07:28:19 +03:00
Paul Sokolovsky
0c124c3123
unix: Add "_os" module with stat().
...
stat() is bad function to use using FFI, because its ABI is largely private.
To start with, Glibc .so doesn't even have "stat" symbol. Then, layout of
struct stat is too implementation-dependent. So, introduce _os to deal
with stat() and other similar cases.
2014-05-14 22:08:45 +03:00
Paul Sokolovsky
2a27365854
objstr.c: Partial implementation of .rsplit().
...
sep=None is TODO.
2014-05-14 02:42:20 +03:00
Damien George
51fab28e94
py: Improve mpz_and function.
...
This should now have correct (and optimal) behaviour.
2014-05-13 22:58:00 +01:00
Damien George
f6e430f77f
Merge pull request #600 from stinos/unix-exitcode
...
unix: Use standard return codes for main
2014-05-13 22:39:35 +01:00
Damien George
aeeb448eb6
Merge pull request #613 from pfalcon/pauls-copyr
...
py, unix: Add copyright for modules I worked closely on.
2014-05-13 22:36:36 +01:00
Paul Sokolovsky
da9f0924ef
py, unix: Add copyright for modules I worked closely on.
2014-05-13 18:41:25 +03:00
Paul Sokolovsky
7074f25768
tests/int-long.py: Try to expose issue with recent "&" optimization.
2014-05-13 08:24:54 +03:00
Damien George
561e425903
py: Fix bug in mpz_and function.
...
Addresses issue #610 .
2014-05-12 23:27:29 +01:00
Damien George
cc97446ca5
unix: Implement -O option to turn off __debug__ flag.
2014-05-12 23:14:52 +01:00
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.
2014-05-12 23:11:14 +01:00
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.
2014-05-12 23:07:34 +01:00
Damien George
96f137b24a
py: Rename BYTE_CODE to BYTECODE (this was missed in previous rename).
2014-05-12 22:35:37 +01:00
stijn
f42dbb98d1
unix: Fix linker errors when time/ffi modules are disabled
...
When disabling these via mpconfigport.mk or on the commandline,
the correspoding build options are not set and the sources are not
built so the modules should not be added to the
MICROPY_EXTRA_BUILTIN_MODULES list since they are undefined.
2014-05-13 00:03:24 +03:00
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.
2014-05-12 23:45:50 +03:00
Paul Sokolovsky
147c80bf7c
modstruct: Use MP_OBJ_FUN_ARGS_MAX instead of -1.
2014-05-11 22:50:27 +03:00
Paul Sokolovsky
5ebd5f0f19
objstr: Slice indexing: support bytes properly.
2014-05-11 21:22:59 +03:00
Paul Sokolovsky
bfb8819c0c
objstr: Make .split() support bytes.
2014-05-11 21:17:28 +03:00
Paul Sokolovsky
5e5d69b35e
objstr: Make .join() support bytes.
2014-05-11 21:13:01 +03:00
Paul Sokolovsky
7e7940c39d
py: Fix __len__ special method result handling.
...
Having both MP_OBJ_NOT_SUPPORTED and MP_OBJ_NULL is arguably confusing.
2014-05-11 20:51:31 +03:00
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.
2014-05-11 20:51:31 +03:00
Paul Sokolovsky
0f570cfccf
showbc: Decode MAP_ADD.
2014-05-11 20:51:31 +03:00
Paul Sokolovsky
ff30666c69
py: Add basic implementation of hasattr() function.
2014-05-11 20:51:30 +03:00
Damien George
a0863158f5
Merge pull request #605 from stinos/travis-mingw
...
travis: Add cross-compilation of mingw port
2014-05-11 18:48:15 +01:00
Damien George
96b62855b5
Merge pull request #604 from stinos/windows-enablefeat
...
windows: Enable frozen set and sys.exit
2014-05-11 18:41:48 +01:00
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.
2014-05-11 18:37:21 +01:00
stijn
5f9ebd36cd
travis: Add cross-compilation of mingw port
2014-05-11 19:33:13 +02:00
Damien George
1d34e32431
py: frozenset() creates an empty frozenset.
2014-05-11 18:28:48 +01:00
stijn
b9d8091d0e
windows: Enable frozen set and sys.exit
2014-05-11 19:26:36 +02:00
stijn
9e040b7cd8
unix: Use standard return codes for main
...
As in the CPython manual: "Unix programs generally use 2 for
command line syntax errors and 1 for all other kind of errors"
2014-05-11 19:23:30 +02:00
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.
2014-05-11 18:00:45 +01:00
Damien George
c59af52e84
py: Rename some unichar functions for consistency.
2014-05-11 17:53:11 +01:00
Damien George
89755ae67f
py: Rename MICROPY_SYS_EXIT to MICROPY_MOD_SYS_EXIT.
...
For consistency with MICROPY_MOD_SYS_STDFILES, etc.
2014-05-11 17:35:43 +01:00