Wykres commitów

3399 Commity (12c66be2b8baab093c7be5e2108d2767c9779a69)

Autor SHA1 Wiadomość Data
Damien George 12c66be2b8 tests: Add some tests to improve coverage.
Used gcov to find some parts of vm.c, runtime.c, obj.c that were not
covered by any tests.  Still need to use gcov more thoroughly.
2015-01-29 00:44:11 +00:00
Damien George 81e70a88a7 py: Make REPL printing function print repr of object, not str.
Addresses issue #1014.
2015-01-28 23:53:13 +00:00
Damien George 0d3cb6726d py: Change vstr so that it doesn't null terminate buffer by default.
This cleans up vstr so that it's a pure "variable buffer", and the user
can decide whether they need to add a terminating null byte.  In most
places where vstr is used, the vstr did not need to be null terminated
and so this patch saves code size, a tiny bit of RAM, and makes vstr
usage more efficient.  When null termination is needed it must be
done explicitly using vstr_null_terminate.
2015-01-28 23:43:01 +00:00
Paul Sokolovsky 57aebe1714 tests: Add testcase for bytes() on values in range 128-255. 2015-01-28 22:29:51 +02:00
Paul Sokolovsky bbd9251bac py: bytes(): Make sure we add values as bytes, not as chars. 2015-01-28 22:29:07 +02:00
Damien George 98e3a64694 py: Remove duplicated mp_obj_str_make_new function from objstrunicode.c. 2015-01-28 14:14:57 +00:00
Damien George 16677ce311 py: Be more precise about unicode type and disabled unicode behaviour. 2015-01-28 14:07:11 +00:00
Damien George 0ecd5988a2 stmhal: Remove unnecessary #include "systick.h" from pyexec.c.
Makes pyexec.c more re-usable for other ports.
2015-01-28 00:59:27 +00:00
Paul Sokolovsky e9995bdea2 moduzlib: Align out buffer to block size; shrink when decompression done. 2015-01-28 02:30:01 +02:00
Paul Sokolovsky 2324f3ef29 moduzlib: Implement raw DEFLATE decoding support. 2015-01-28 02:21:49 +02:00
David Steinberg 0b3014ce3a py: Add support for floats in mp_binary_{get,set}_val()
- This then provides support for floats in the struct package
2015-01-27 22:49:01 +02:00
Damien George a5efcd4745 py: Specify unary/binary op name in TypeError error message.
Eg, "() + 1" now tells you that __add__ is not supported for tuple and
int types (before it just said the generic "binary operator").  We reuse
the table of names for slot lookup because it would be a waste of code
space to store the pretty name for each operator.
2015-01-27 18:02:25 +00:00
Damien George a9dc9b8f6d py: Fix comparison of minus-zero long int. 2015-01-27 17:47:38 +00:00
Paul Sokolovsky e6a118ee85 moduzlib: Update to uzlib v1.2.
Actually manage size of the output buffer.
2015-01-26 22:01:45 +02:00
Damien George 2f8c409a4f qemu-arm: Disable try_finally1.py test (it fails randomly on Travis). 2015-01-25 18:48:03 +00:00
Damien George 8788b131ec py: Check for NDEBUG using #ifdef rather than #if.
Defining NDEBUG (to any value, even 0) disables debugging.  Otherwise,
if it's not defined, debugging is enabled.
2015-01-25 18:35:54 +00:00
Damien George 17d299b7bd lib/mp-readline: Use simple VT100 commands to speed up line redraw. 2015-01-25 18:26:07 +00:00
Damien George 4b35a5464c Merge branch 'master' of github.com:micropython/micropython 2015-01-25 17:11:47 +00:00
Paul Sokolovsky 5fb775a0c0 esp8266: Handle exceptions in callback. 2015-01-25 17:41:06 +02:00
Paul Sokolovsky 6ec650b41f esp8266: Add "esp" module with esp8266-specific "cooperative" networking.
So far implements .scan(lambda x: print(x)) function to scan for WiFi access
points.
2015-01-25 17:10:06 +02:00
Damien George 552f7c40a0 docs: Bump version to 1.3.9. 2015-01-25 00:10:07 +00:00
Damien George ad33e2465c stmhal: Disable MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE.
It uses RAM and on pyboard we are generally tight on RAM, so disable
this optimisation for general builds.  If users need the speed then
they can build their own version.  Maybe in the future we can have
different versions of pyboard firmware built with different tradeoffs.
2015-01-24 23:45:37 +00:00
Paul Sokolovsky 31c1f1300e modffi: 's' (string) return type: handle NULL properly (return None). 2015-01-25 01:36:14 +02:00
Damien George 32444b759a py: Don't use anonymous unions, name them instead.
This makes the code (more) compatible with the C99 standard.
2015-01-24 23:14:12 +00:00
Damien George 5c670acb1f py: Be more machine-portable with size of bit fields. 2015-01-24 23:12:58 +00:00
David Steinberg 4c1a7e0d6a tests: Update float2int tests for new range classifications
- Tests vary based on build configuration (32/64-bit and internal int type).
- Added tests for exceptions raised on overflow of int type.
2015-01-24 21:05:16 +00:00
David Steinberg 0fb17f6ef4 py: Use float-to-int classifications for mp_obj_new_int_from_float() functions 2015-01-24 20:54:28 +00:00
David Steinberg ca377b10de py: Add float-to-int classification function 2015-01-24 20:54:28 +00:00
David Steinberg 8d427b7ab7 py: Fix issue in mpz_set_from_float() when mp_int_t is larger than float 2015-01-24 20:54:28 +00:00
David Steinberg c585ad1020 py: Move mp_float_t related defines to misc.h 2015-01-24 20:54:28 +00:00
stijn 6b636738b2 py: Fix segfault in namedtuple when name is a non-interned string
- namedtuple was wrongly using MP_OBJ_QSTR_VALUE instead of mp_obj_str_get_qstr,
so when passed a non-interned string it would segfault; fix this by using mp_obj_str_get_qstr
- store the namedtuple field names as qstrs so it is not needed to use mp_obj_str_get_qstr
everytime the field name has to be accessed. This also slighty increases performance when
fetching attributes
2015-01-24 20:21:09 +00:00
Damien George 23342c09ff stmhal: Bug fix for usocket's accept and setsockopt methods.
accept might raise an exception, in which case the new socket is not
fully created.  It has a finaliser so will run close() method when GC'd.
Before this patch close would try to close an invalid socket.  Now
fixed.

setsockopt took address of stack value which became out of scope.  Now
fixed.
2015-01-24 15:07:50 +00:00
Paul Sokolovsky 91232d3850 binary: Rework array accessors. They work with native, not stdint types. 2015-01-24 03:18:33 +02:00
Paul Sokolovsky ca3dbb8d8b stream: readall(): Make sure there's a trailing NUL char. 2015-01-24 00:22:47 +02:00
Paul Sokolovsky 66b060f3e6 tests: Fix typo in file_long_read3.py. 2015-01-23 19:00:02 +02:00
Paul Sokolovsky 444331c07f modujson: .loads(): Handle more whitespace characters. 2015-01-23 18:41:29 +02:00
Paul Sokolovsky 1f04336b23 tests: Add extra test for reading multiple of internal chunk size. 2015-01-23 18:18:11 +02:00
Paul Sokolovsky 425f952a1e stream: Fix readall() implementation in respect to NUL terminator bytes.
After vstr refactor. Fixes #1084.
2015-01-23 17:59:37 +02:00
Paul Sokolovsky 220d21e1bf tests: Add testcase for reading amounts bigger than buffer/chunk size. 2015-01-23 16:42:02 +02:00
Paul Sokolovsky 344e15b1ae objstr: Remove code duplication and unbreak Windows build.
There was really weird warning (promoted to error) when building Windows
port. Exact cause is still unknown, but it uncovered another issue:
8-bit and unicode str_make_new implementations should be mutually exclusive,
and not built at the same time. What we had is that bytes_decode() pulled
8-bit str_make_new() even for unicode build.
2015-01-23 02:15:56 +02:00
Paul Sokolovsky 6113eb2f33 objstr*: Use separate names for locals_dict of 8-bit and unicode str's.
To somewhat unbreak -DSTATIC="" compile.
2015-01-23 02:05:58 +02:00
Damien George e5bcbcdebd py: Allow asmx64 to compile with -Wsign-compare.
See issue #699.
2015-01-22 14:08:58 +00:00
Damien George 6d1f5070ce lib/libm: Add frexp and modf functions; use in stmhal; add tests.
Addresses issue #1081.
2015-01-22 13:48:29 +00:00
Damien George bd9c1ad601 stmhal: Make CC3K object static, so it's only registered once as NIC. 2015-01-22 00:17:40 +00:00
Damien George 8b77e3dd2f stmhal: Put mod_network_nic_list in global root-pointer state.
It needs to be scanned by GC.  Thanks to Daniel Campora.
2015-01-22 00:16:41 +00:00
Damien George 77089bebd4 py: Add comments for vstr_init and mp_obj_new_str. 2015-01-21 23:18:02 +00:00
Damien George 05005f679e py: Remove mp_obj_str_builder and use vstr instead.
With this patch str/bytes construction is streamlined.  Always use a
vstr to build a str/bytes object.  If the size is known beforehand then
use vstr_init_len to allocate only required memory.  Otherwise use
vstr_init and the vstr will grow as needed.  Then use
mp_obj_new_str_from_vstr to create a str/bytes object using the vstr
memory.

Saves code ROM: 68 bytes on stmhal, 108 bytes on bare-arm, and 336 bytes
on unix x64.
2015-01-21 23:18:02 +00:00
Damien George 0b9ee86133 py: Add mp_obj_new_str_from_vstr, and use it where relevant.
This patch allows to reuse vstr memory when creating str/bytes object.
This improves memory usage.

Also saves code ROM: 128 bytes on stmhal, 92 bytes on bare-arm, and 88
bytes on unix x64.
2015-01-21 23:17:27 +00:00
Paul Sokolovsky 2e526ff1a1 modffi: Support return values of mp_obj_t type. 2015-01-22 01:09:17 +02:00
Paul Sokolovsky 8064892c9b builtinimport: Make sure that qstr is used properly to load frozen modules. 2015-01-21 23:14:46 +02:00