Bas van Sisseren
a14ce77b28
py/binary.c: Fix bug when packing big-endian 'Q' values.
Without bugfix:
struct.pack('>Q', 16)
b'\x00\x00\x00\x10\x00\x00\x00\x00'
With bugfix:
struct.pack('>Q', 16)
b'\x00\x00\x00\x00\x00\x00\x00\x10'
7 years ago
Paul Sokolovsky
bfc2092dc5
py/modsys: Initial implementation of sys.getsizeof().
Implemented as a new MP_UNARY_OP. This patch adds support lists, dicts and
instances.
7 years ago
Damien George
3d25d9c7d9
py/objstr: Raise an exception for wrong type on RHS of str binary op.
The main case to catch is invalid types for the containment operator, of
the form str.__contains__(non-str).
7 years ago
Damien George
eb2784e8a2
py/objtuple: Allow to use inplace-multiplication operator on tuples.
7 years ago
Alexander Steffen
55f33240f3
all: Use the name MicroPython consistently in comments
There were several different spellings of MicroPython present in comments,
when there should be only one.
7 years ago
Damien George
04552ff71b
py: Implement raising a big-int to a negative power.
Before this patch raising a big-int to a negative power would just return
0. Now it returns a floating-point number with the correct value.
7 years ago
Tom Collins
6cfe737597
tests/basics/builtin_exec: Test various globals/locals args to exec().
7 years ago
Damien George
6c1b7e008d
tests: Rename exec1.py to builtin_exec.py.
7 years ago
Paul Sokolovsky
4368ae3142
extmod/modussl_axtls: Allow to close ssl stream multiple times.
Make sure that 2nd close has no effect and operations on closed streams
are handled properly.
7 years ago
Damien George
761e4c7ff6
all: Remove trailing spaces, per coding conventions.
7 years ago
Paul Sokolovsky
ad3abcd324
tests/cpydiff: Add case for str.ljust/rjust.
7 years ago
Paul Sokolovsky
0c5369a1f0
tests/cpydiff/: Improve wording, add more workarounds.
7 years ago
Paul Sokolovsky
5f65ad8c96
tests/cpydiff/core_class_supermultiple: Same cause as core_class_mro.
7 years ago
Paul Sokolovsky
c5efb8159f
tests/cpydiff/core_arguments: Move under Functions subsection.
This is the last "orphan" case.
7 years ago
Paul Sokolovsky
b2979023ac
tests/cpydiff/core_class_mro: Move under Classes, add workaround.
7 years ago
Damien George
f69ab79ec8
py/objgenerator: Allow to hash generators and generator instances.
Adds nothing to the code size, since it uses existing empty slots in the
type structures.
7 years ago
Paul Sokolovsky
ed52955c6b
tests/cpydiff/modules_deque: Elaborate workaround.
7 years ago
Krzysztof Blazewicz
7feb7301b2
tests/basics: Add tests for arithmetic operators precedence.
8 years ago
Damien George
6b8b56f859
py/modmath: Check for zero division in log with 2 args.
7 years ago
Damien George
b86c65d31c
extmod/modubinascii: Add check for empty buffer passed to hexlify.
Previous to this patch hexlify(b'', b':') would lead to a bad crash due to
the computed length of the result being -1=0xffffffff.
7 years ago
Paul Sokolovsky
58b7b01cb5
extmod/modure: If input string is bytes, return bytes results too.
This applies to match.group() and split().
For ARM Thumb2, this increased code size by 12 bytes.
7 years ago
Damien George
369e7fd178
tests/unix/extra_coverage: Add test for mp_vprintf with bad fmt spec.
7 years ago
Damien George
8f6ef8de48
tests/basics/namedtuple1: Add test for creating with pos and kw args.
7 years ago
Damien George
409fc8f9c1
tests/import: Update comment now that uPy raises correct exception.
7 years ago
Damien George
3a9445c6b3
tests/import: Add a test for the builtin __import__ function.
8 years ago
Damien George
4a6c0fda78
tests: Auto detect floating point capabilites of the target.
The floating-point precision of the target is detected (0, 30, 32 or 64)
and only those tests which can run on the target will be run.
7 years ago
Paul Sokolovsky
bc7659eb59
tests/connect_nonblock: Refactor towards real net_hosted test.
In the future, a special runner for such tests will import each test and
call test() function with an address of test server to use.
7 years ago
Paul Sokolovsky
3f9d59c87a
tests/net_inet: Move tests which don't require full Internet to net_hosted.
The idea is that these tests can be run with just a test server running
on a test host, with device under test connecting to it, instead of
requiring Internet connection for testing.
Such setup is however WIP, and some tests in net_hosted/ are so far
written to connect to Internet, as there're not test server written
yet. This is expected to evolve over time.
7 years ago
Damien George
44922934f5
tests/basics: Add tests for for-else statement.
7 years ago
Damien George
458cbacb8f
tests/net_inet: Add tests for accept and connect in nonblocking mode.
Some of these tests don't require an Internet connection, but here is a
good place to put them for now.
7 years ago
Paul Sokolovsky
4caa27ae0e
tests/net_inet/test_tls_sites.py: Integration test for SSL connections.
This attempts to bootstrap network tests for MicroPython. This commits
sets test/net_inet/ as place for tests which require access to wide
Internet. They aren't intended to be run as part of the main testsuite,
instead to be run manually on demand.
test_tls_sites.py in particular check that it's possible to establish
SSL/TLS connection to select sites on the Internet: few references ones,
plus those for which problems were reported, and resolved.
7 years ago
Damien George
e269cabe3e
py/objint: In to_bytes(), allow length arg to be any int and check sign.
8 years ago
Damien George
8c5632a869
py/objint: Support "big" byte-order in int.to_bytes().
8 years ago
Damien George
1e70fda69f
py/compile: Raise SyntaxError if positional args are given after */**.
In CPython 3.4 this raises a SyntaxError. In CPython 3.5+ having a
positional after * is allowed but uPy has the wrong semantics and passes
the arguments in the incorrect order. To prevent incorrect use of a
function going unnoticed it is important to raise the SyntaxError in uPy,
until the behaviour is fixed to follow CPython 3.5+.
8 years ago
Damien George
e374cfff80
py/modthread: Raise RuntimeError in release() if lock is not acquired.
8 years ago
Damien George
6ed4581f54
py/formatfloat: Fix number of digits and exponent sign when rounding.
This patch fixes 2 things when printing a floating-point number that
requires rounding up of the mantissa:
- retain the correct precision; eg 0.99 becomes 1.0, not 1.00
- if the exponent goes from -1 to 0 then render it as +0, not -0
8 years ago
Damien George
f55dcddbc7
tests/extmod/vfs_basic: Allow test to pass on embedded targets.
8 years ago
Paul Sokolovsky
85d809d1f4
tests: Convert remaining "sys.exit()" to "raise SystemExit".
8 years ago
Paul Sokolovsky
a2803b74f4
tests/basics: Convert "sys.exit()" to "raise SystemExit".
8 years ago
Paul Sokolovsky
07241cd37a
py/objstringio: If created from immutable object, follow copy on write policy.
Don't create copy of immutable object's contents until .write() is called
on BytesIO.
8 years ago
Paul Sokolovsky
e094200750
tests/float/builtin_float_minmax: PEP8 fixes.
8 years ago
Damien George
fde54350a8
tests/float: Convert "sys.exit()" to "raise SystemExit".
The latter is shorter and simpler because it doesn't require importing the
sys module.
8 years ago
Damien George
f6ef8e3f17
extmod/vfs: Allow to statvfs the root directory.
8 years ago
Damien George
7400d88762
tests/basics/string_rsplit: Add tests for negative "maxsplit" argument.
8 years ago
Ville Skyttä
ca16c38210
various: Spelling fixes
8 years ago
Damien George
8b13cd7e19
tests/basics: Add more tests for unwind jumps from within a try-finally.
These tests excercise cases that are fixed by the previous two commits.
8 years ago
Damien George
218a876f97
tests/basics/builtin_range: Add tests for negative slicing of range.
8 years ago
Damien George
e1b0f2a16f
tests/basics/list_slice_3arg: Add more tests for negative slicing.
8 years ago
Tom Collins
162a0f942b
tests/io/bytesio_ext: Test read() after seek() past end of BytesIO object.
8 years ago
Paul Sokolovsky
054a381d7c
tests/extmod/vfs_fat_more: Make skippable is uos is not available.
Fixes Zephyr tests.
8 years ago