Tom Soulanille
2a8a564fbd
tests: Test slicing a range that does not start at zero.
9 years ago
Delio Brignoli
e6978a4e26
py: Fix call args when a stararg is followed by keyword args.
9 years ago
Tom Soulanille
aeb62f9ae3
py/objslice: Make slice attributes (start/stop/step) readable.
Configurable with MICROPY_PY_BUILTINS_SLICE_ATTRS. Disabled by default.
9 years ago
Damien George
8b4fb4fe14
py/mpz: Fix calculation of max digit storage for mpz; fix sys.maxsize.
When creating constant mpz's, the length of the mpz must be exactly how
many digits are used (not allocated) otherwise these numbers are not
compatible with dynamically allocated numbers.
Addresses issue #1448 .
9 years ago
Damien George
75a811a6df
tests: Move int+unicode test to unicode-specific test directory.
9 years ago
Damien George
558a016e2c
py/compile: Refine SyntaxError for repeated use of global/nonlocal.
9 years ago
Damien George
25afc7da0d
tests: Add tests to improve coverage of objstr.c.
9 years ago
Damien George
81794fcd31
py/binary: Add support for array('q') and array('Q').
9 years ago
Paul Sokolovsky
ab2594e341
tests: Add test for exception-chaining raise syntax.
9 years ago
Damien George
000730ecaa
py/objstr: Simplify error handling for bad conversion specifier.
9 years ago
Damien George
c2ec2ad8fb
tests: Add test where __getitem__ raises IndexError to stop iteration.
9 years ago
Damien George
b648e98ad0
py/objstr: Fix error reporting for unexpected end of modulo format str.
9 years ago
Damien George
7ef75f9f75
py/objstr: Fix error type for badly formatted format specifier.
Was KeyError, should be ValueError.
9 years ago
Damien George
1d350b8ac6
tests: Add a few tests for bool, bytearray, float to improve coverage.
9 years ago
Paul Sokolovsky
58d9b10d70
tests: Split byteorder-dependent tests to *_endian.py's.
9 years ago
Paul Sokolovsky
a160b70ced
tests: Add test on set/frozenset equality.
9 years ago
Paul Sokolovsky
8b3b2d04a8
objset: frozensets are hashable.
9 years ago
Damien George
d007cb8903
tests: Add more tests to improve coverage, mostly testing exceptions.
9 years ago
Damien George
9a2913ed1c
py/objlist: Make list += accept all arguments and add test.
9 years ago
Damien George
3900fed849
tests: Skip parser test if "compile" builtin is not available.
9 years ago
Damien George
96f0dd3cbc
py/parse: Fix handling of empty input so it raises an exception.
9 years ago
Damien George
d241c2a592
py/lexer: Raise SyntaxError when str hex escape sequence is malformed.
Addresses issue #1390 .
9 years ago
Delio Brignoli
32aba40830
py: Implement memoryview slice assignment.
Adds ability to do "memcpy" with memoryview objects, such as:
m1[0:3] = m2[2:5].
10 years ago
Sebastian Plamauer
1e8ca3a3cf
modbuiltins: Implement round() to precision.
9 years ago
Daniel Campora
d709622bd2
tests: Adapt basics/memoryerror.py for ports with lower heap sizes.
10 years ago
Damien George
06593fb0f2
py: Use a wrapper to explicitly check self argument of builtin methods.
Previous to this patch a call such as list.append(1, 2) would lead to a
seg fault. This is because list.append is a builtin method and the first
argument to such methods is always assumed to have the correct type.
Now, when a builtin method is extracted like this it is wrapped in a
checker object which checks the the type of the first argument before
calling the builtin function.
This feature is contrelled by MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG and
is enabled by default.
See issue #1216 .
10 years ago
Damien George
e9ce00d874
py: Implement divmod for mpz bignum.
10 years ago
Damien George
7bab32ef89
tests: Add further tests for class defining __hash__.
10 years ago
Damien George
c2a4e4effc
py: Convert hash API to use MP_UNARY_OP_HASH instead of ad-hoc function.
Hashing is now done using mp_unary_op function with MP_UNARY_OP_HASH as
the operator argument. Hashing for int, str and bytes still go via
fast-path in mp_unary_op since they are the most common objects which
need to be hashed.
This lead to quite a bit of code cleanup, and should be more efficient
if anything. It saves 176 bytes code space on Thumb2, and 360 bytes on
x86.
The only loss is that the error message "unhashable type" is now the
more generic "unsupported type for __hash__".
10 years ago
Paul Sokolovsky
6738c1dded
vm: Properly handle StopIteration raised in user instance iterator.
I.e. in bytecode Python functions.
10 years ago
Paul Sokolovsky
4ed7b7f751
py: iternext() may not return MP_OBJ_NULL, only MP_OBJ_STOP_ITERATION.
Testing for incorrect value led to premature termination of generator
containing yield from for such iterator (e.g. "yield from [1, 2]").
10 years ago
Damien George
9a42eb541e
py: Fix naming of function arguments when function is a closure.
Addresses issue #1226 .
10 years ago
Paul Sokolovsky
37c6555b44
obj: Handle user instance hash based on Python adhoc rules.
User instances are hashable by default (using __hash__ inherited from
"object"). But if __eq__ is defined and __hash__ not defined in particular
class, instance is not hashable.
10 years ago
Paul Sokolovsky
3d3ef36e97
modstruct: Rename module to "ustruct", to allow full Python-level impl.
10 years ago
Damien George
47b9809d23
py: Check that arg to object.__new__ is a user-defined type.
Addresses issue #1203 .
10 years ago
Damien George
271d18eb08
py: Support conversion of bignum to bytes.
This gets int.to_bytes working for bignum, and also struct.pack with 'q'
and 'Q' args on 32-bit machines.
Addresses issue #1155 .
10 years ago
Damien George
1f9e2188a6
tests: Add tests for attrtuple, and for more corner cases.
10 years ago
Damien George
d8cbbcaa9d
py: Fix builtin ord so that it can handle bytes values >= 0x80.
Addresses issue #1188 .
10 years ago
Damien George
90aa7595b4
tests: Convert line endings in fun_name.py from CRLF to LF.
10 years ago
Paul Sokolovsky
56beb01724
objarray: Support assignment of bytes to bytearray slice.
10 years ago
Paul Sokolovsky
8b7faa31e1
objstr: split(None): Fix whitespace properly.
10 years ago
Damien George
e5c4362a98
tests: Add some more tests to improve code coverage of corner cases.
10 years ago
Damien George
97abe22963
tests: Add tests to exercise lexer; and some more complex number tests.
10 years ago
Damien George
9dd3640464
tests: Add missing tests for builtins, and many other things.
10 years ago
Paul Sokolovsky
620058cc57
tests: Add test for str.splitlines().
10 years ago
Paul Sokolovsky
ad038ca101
tests/class_descriptor.py: Fix line-endings (were CRLF).
10 years ago
stijn
28fa84b445
py: Add optional support for descriptors' __get__ and __set__ methods.
Disabled by default. Enabled on unix and windows ports.
10 years ago
Damien George
23d7fd526d
tests: Skip some new tests when testing native emitter.
10 years ago
Damien George
214179b430
tests: Add tests for SyntaxError, TypeError, and other missing things.
This is intended to improve coverage of the test suite.
10 years ago
stijn
3cc17c69ff
py: Allow retrieving a function's __name__.
Disabled by default. Enabled on unix and stmhal ports.
10 years ago