Damien George
42f3de924b
py: Convert [u]int to mp_[u]int_t where appropriate.
...
Addressing issue #50 .
2014-10-03 17:44:14 +00:00
Damien George
8b03d944e2
py: Remove IOError since it's deprecated; use OSError instead.
...
In CPython IOError (and EnvironmentError) is deprecated and aliased to
OSError. All modules that used to raise IOError now raise OSError (or a
derived exception).
In Micro Python we never used IOError (except 1 place, incorrectly) and
so don't need to keep it.
See http://legacy.python.org/dev/peps/pep-3151/ for background.
2014-09-30 13:59:30 +00:00
Damien George
4bcd04bcad
py: Tidy up exception matching; allow matching of tuple of exceptions.
...
Addresses issue #864 .
2014-09-25 15:49:26 +01:00
Damien George
612045f53f
py: Add native json printing using existing print framework.
...
Also add start of ujson module with dumps implemented. Enabled in unix
and stmhal ports. Test passes on both.
2014-09-17 22:56:34 +01:00
Damien George
8594ce2280
py: Implement divmod, % and proper // for floating point.
...
Tested and working on unix and pyboard.
2014-09-13 18:43:09 +01:00
Damien George
953074315e
py: Enable struct/binary-helper to parse q and Q sized ints.
...
Addresses issue #848 .
2014-09-10 22:10:33 +01:00
Damien George
c7687ad7e6
py: Rename mp_builtin_id to mp_obj_id and make it public.
2014-09-07 20:41:09 +01:00
Damien George
6c9c7bc75a
stmhal: Implement generic select.select and select.poll.
2014-09-07 20:40:32 +01:00
Damien George
c8c44a4c2e
py: Add ioctl method to stream protocol; add initial modselect.
2014-09-07 20:40:10 +01:00
Damien George
4d91723587
py: Remove use of int type in obj.h.
...
Part of code cleanup, working towards resolving issue #50 .
2014-08-30 14:28:06 +01:00
Damien George
d182b98a37
py: Change all uint to mp_uint_t in obj.h.
...
Part of code cleanup, working towards resolving issue #50 .
2014-08-30 14:19:41 +01:00
Damien George
9c4cbe2ac0
py: Make tuple and list use mp_int_t/mp_uint_t.
...
Part of code cleanup, to resolve issue #50 .
2014-08-30 14:04:14 +01:00
Damien George
93965e726f
py: Make map, dict, set use mp_int_t/mp_uint_t exclusively.
...
Part of code cleanup, towards resolving issue #50 .
2014-08-30 13:23:35 +01:00
Damien George
ecc88e949c
Change some parts of the core API to use mp_uint_t instead of uint/int.
...
Addressing issue #50 , still some way to go yet.
2014-08-30 00:35:11 +01:00
Damien George
17ae2395c2
py: Use memmove instead of memcpy when appropriate.
...
Found this bug by running unix/ tests with DEBUG=1 enabled when
compiling.
2014-08-29 21:07:54 +01:00
Damien George
a75b02ea9b
py: Improve efficiency of MP_OBJ_IS_STR_OR_BYTES.
...
Saves ROM (16 on stmhal, 240 on 64-bit unix) and should be quicker since
there is 1 less branch.
2014-08-27 09:20:30 +01:00
Dave Hylands
b7f7c655ed
Make int(b'123') work properly.
2014-08-26 19:15:04 -07:00
Damien George
3c658a4e75
py: Fix bug where GC collected native/viper/asm function data.
...
Because (for Thumb) a function pointer has the LSB set, pointers to
dynamic functions in RAM (eg native, viper or asm functions) were not
being traced by the GC. This patch is a comprehensive fix for this.
Addresses issue #820 .
2014-08-24 16:28:17 +01:00
Damien George
2ac4af6946
py: Allow viper to have type annotations.
...
Viper functions can now be annotated with the type of their arguments
and return value. Eg:
@micropython.viper
def f(x:int) -> int:
return x + 1
2014-08-15 16:45:41 +01:00
Damien George
4c03b3a899
py: Implement builtin reversed() function.
...
reversed function now implemented, and works for tuple, list, str, bytes
and user objects with __len__ and __getitem__.
Renamed mp_builtin_len to mp_obj_len to make it publically available (eg
for reversed).
2014-08-12 18:33:40 +01:00
Paul Sokolovsky
7133d91773
py: mp_buffer_info_t::buf may be valid, but NULL for empty objects.
...
This happens for example for zero-size arrays. As .get_buffer() method now
has explicit return value, it's enough to distinguish success vs failure
of getting buffer.
2014-08-10 16:22:48 +03:00
Damien George
bb4c6f35c6
py: Make MP_OBJ_NEW_SMALL_INT cast arg to mp_int_t itself.
...
Addresses issue #724 .
2014-07-31 10:49:14 +01:00
Damien George
5f27a7e811
py: Add mp_obj_str_builder_end_with_len.
...
This allows to create str's with a smaller length than initially asked
for.
2014-07-31 10:29:56 +01:00
Damien George
07133415d2
Merge pull request #738 from dhylands/except-args
...
Add support for storing args during an exception raised by an irq.
2014-07-29 23:15:35 +01:00
Damien George
adf0f2ae1a
py: Change stream protocol API: fns return uint; is_text for text.
2014-07-27 22:38:58 +01:00