Commit Graph

2158 Commits

Author SHA1 Message Date
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
Damien George f92a0d4d16 stmhal: Enable frozenset. Takes 292 text bytes in ROM. 2014-05-11 17:27:31 +01:00
Damien George bd651d1a67 Merge pull request #597 from stinos/mingw-compilation
mingw: Fix compilation issues
2014-05-11 15:06:26 +01:00
Damien George c3dcb590b8 Merge pull request #603 from stinos/windows-tests-newline
tests: Fix handling of newlines from expected output files on windows
2014-05-11 15:03:57 +01:00
Damien George 18ceb7055b Merge branch 'master' of github.com:micropython/micropython 2014-05-11 12:10:35 +01:00
Damien George a7a1a38df4 stmhal: Update CC3000 driver to newer version.
Still not working properly.
2014-05-11 12:09:13 +01:00
Paul Sokolovsky eea0118654 py: Give up and make mp_obj_str_get_data() deal with bytes too.
This is not fully correct re: error handling, because we should check that
that types are used consistently (only str's or only bytes), but magically
makes lot of functions support bytes.
2014-05-11 13:51:24 +03:00
stijn a4dbc73e8a tests: Fix handling of newlines from expected output files 2014-05-11 12:45:02 +02:00
Paul Sokolovsky b2d4fc06fc objstr: Make *strip() accept bytes. 2014-05-11 13:17:29 +03:00
Paul Sokolovsky ce6c10172b tests: Really fix import. 2014-05-11 03:45:42 +03:00
Paul Sokolovsky b4acd028b6 tests: Fix import. 2014-05-11 03:40:32 +03:00
Paul Sokolovsky ea9708092e objtuple: Go out of the way to support comparison of subclasses.
Two things are handled here: allow to compare native subtypes of tuple,
e.g. namedtuple (TODO: should compare type too, currently compared
duck-typedly by content). Secondly, allow user sunclasses of tuples
(and its subtypes) be compared either. "Magic" I did previously in
objtype.c covers only one argument (lhs is many), so we're in trouble
when lhs is native type - there's no other option besides handling
rhs in special manner. Fortunately, this patch outlines approach with
fast path for native types.
2014-05-11 03:33:19 +03:00
Paul Sokolovsky 9511f60f01 py: Don't try to "bind" types store as attributes of objects.
This was hit when trying to make urlparse.py from stdlib run. Took
quite some time to debug.

TODO: Reconsile bound method creation process better, maybe callable is
to generic type to bind at all?
2014-05-11 03:33:19 +03:00
Paul Sokolovsky 69f3eb2c96 objstr: Make .[r]partition() work with bytes. 2014-05-11 03:33:19 +03:00
Paul Sokolovsky 285683d203 objboundmeth: If detailed reporting enabled, print object content.
Similar to closure and cell.
2014-05-11 02:27:42 +03:00
Paul Sokolovsky 7aca1cae34 py: Start making good use of mp_const_obj_t. 2014-05-11 02:26:42 +03:00
Damien George 50073ed5d6 stmhal/cc3k: Remove spaces and tabs at end of lines. 2014-05-10 21:28:40 +01:00
Paul Sokolovsky 3f8d34ca83 objlist: Support list slice deletion. 2014-05-10 23:03:30 +03:00
Paul Sokolovsky 94d8246272 objlist: Implement non-growing slice assignment.
Slice value to assign can be only a list so far too.
2014-05-10 22:24:31 +03:00