Dave Hylands
a17755ee8b
py: Add ustruct.pack_into and unpack_from
9 years ago
chrysn
f8ba2eca80
builtin property: accept keyword arguments
this allows python code to use property(lambda:..., doc=...) idiom.
named versions for the fget, fset and fdel arguments are left out in the
interest of saving space; they are rarely used and easy to enable when
actually needed.
a test case is included.
9 years ago
stijn
dea585f8ae
tests: Remove builtin_dict test
This is essentially a duplicate of obj_dict.py
9 years ago
Damien George
d4df8f4925
py/objstr: In str.format, handle case of no format spec for string arg.
Handles, eg, "{:>20}".format("foo"), where there is no explicit spec for
the type of the argument.
9 years ago
Paul Sokolovsky
ee7b8f32e3
tests/object_dict.py: Add test for obj.__dict__ .
9 years ago
stijn
3c014a67ea
py: Implement __dict__ for instances.
Note that even though wrapped in MICROPY_CPYTHON_COMPAT, it is not
fully compatible because the modifications to the dictionary do not
propagate to the actual instance members.
10 years ago
Dave Hylands
7281d95aee
py: Make dir report instance members
9 years ago
Damien George
78913211a9
py: Be more restrictive binding self when looking up instance attrs.
When looking up and extracting an attribute of an instance, some
attributes must bind self as the first argument to make a working method
call. Previously to this patch, any attribute that was callable had self
bound as the first argument. But Python specs require the check to be
more restrictive, and only functions, closures and generators should have
self bound as the first argument
Addresses issue #1675 .
9 years ago
Damien George
8047340d75
py: Handle case of return within the finally block of try-finally.
Addresses issue #1636 .
9 years ago
Paul Sokolovsky
664bc44f30
tests: Add tests for %-formatting of bytes.
This requires CPython3.5, to not require switching to it, just use .exp
file.
9 years ago
Damien George
29e9db0c58
py: Fix compiler to handle lambdas used as default arguments.
Addresses issue #1709 .
9 years ago
Damien George
de2a2e296b
tests: Add test for "not" of a user defined class.
9 years ago
Damien George
3ff259a262
py: Fix calling of parent classmethod from instance of subclass.
Addresses issue #1697 .
9 years ago
Damien George
33ac0fd09f
py: Don't try to optimise for+range when args are not simple expressions.
Addresses issue #1693 .
9 years ago
Paul Sokolovsky
55995869e5
tests/builtin_minmax: Make compatible with @native codegen.
9 years ago
Paul Sokolovsky
36c6d2fa7d
tests/builtin_minmax: Add testcase for lazy iterable (generator).
9 years ago
pohmelie
e23d5a64cf
tests: Add min/max "default" agrument test
9 years ago
Damien George
7a99639cff
py: Fix function calls that have positional and a star-arg-with-iterator.
Addresses issue #1678 .
9 years ago
Damien George
9a56912ad1
py/compile: Do proper checking of * and ** in function definition.
This patch checks that there is only one *, and that ** is last in the
arg list.
9 years ago
Damien George
0e3f29cc99
py: Check that second argument to hasattr is actually a string.
Fixes issue #1623 .
9 years ago
Paul Sokolovsky
4120f32292
tests/int_big_*: Add more tests for result normalization.
Tested by comparability to small int/casting to bool.
9 years ago
Paul Sokolovsky
b56c635d64
tests/int_big_xor: Test that xor result is normalized.
And thus can be successfully used in comparisons, etc.
9 years ago
Damien George
2c83894257
py: Implement default and star args for lambdas.
9 years ago
Paul Sokolovsky
0bd3f3291d
tests/base/struct1.py: Add test for repetition counters.
9 years ago
Damien George
4bf3f2d3c0
py: Fix with+for+return bug by popping for-iter when unwinding exc stack.
Addresses issue #1182 .
9 years ago
Damien George
4300c7dba2
py: Remove dependency on printf/fwrite in mp_plat_print.
See issue #1500 .
9 years ago
Damien George
4fb5ff86ee
tests: Add test for evaluation order of dictionary key/value pairs.
In Python 3.4 the value is evaluated before the key. In Python 3.5 it's
key then value.
9 years ago
Damien George
7e12a601b8
py/compile: Fix edge case when constant-folding negation of integer.
Also adds tests specifically for testing constant folding.
9 years ago
Paul Sokolovsky
062bd81814
tests/basics/builtin_range: PEP8 fixes.
9 years ago
Damien George
34f26ea862
tests: Allow tests to pass against CPython 3.5.
All breaking changes going from 3.4 to 3.5 are contained in
basics/python34.py.
9 years ago
Damien George
e5635f4ab3
py: Catch all cases of integer (big and small) division by zero.
9 years ago
Damien George
2065373f67
py/mpz: Fix bignum anding of large negative with smaller positive int.
9 years ago
Damien George
a81539db25
tests: Add further tests for mpz code.
9 years ago
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