Damien George
095e43a9a5
py/sequence: Allow to use bignums as indices in slice objects.
...
See issue #2264 .
2016-08-15 23:26:34 +10:00
Damien George
f6a8e84a25
tests/basics: Add test for break from within try within a for-loop.
2016-08-15 21:28:41 +10:00
Damien George
d5f42c9daf
tests/basics: Add more list tests to improve coverage testing.
2016-08-15 10:46:35 +10:00
Damien George
3c82d1d34b
tests/basics: Add more tuple tests to improve coverage testing.
2016-08-15 10:46:02 +10:00
Paul Sokolovsky
8897dcb2a1
tests/basics: bytes/str.partition/rpartition are now optional.
...
Skip tests if not available.
2016-08-07 22:14:34 +03:00
Paul Sokolovsky
6af90b2972
py/objstrunicode: str_index_to_ptr: Should handle bytes too.
...
There's single str_index_to_ptr() function, called for both bytes and
unicode objects, so should handle each properly.
2016-07-25 14:45:08 +03:00
Paul Sokolovsky
b652ee705b
tests/bytes_compare: Rework test for bytes <-> str comparison.
...
This may produce a warning, depending on MicroPython configuration.
2016-07-22 12:02:04 +03:00
Mark Anthony Palomer
deaf0712aa
tests: Add testcase for OrderedDict equality.
...
There's a need for .exp file because CPython renders OrderedDict's as:
OrderedDict([('b', 2)])
while MicroPython as:
OrderedDict({'b': 2})
2016-06-12 17:37:19 +03:00
Damien George
715ee9d925
py/modstruct: Allow to have "0s" in struct format.
2016-05-28 23:27:38 +01:00
Antonin ENFRUN
ca41dc2750
py/objnamedtuple: Allow passing field names as a tuple.
...
So the documentation's example works. Besides, a tuple can be more
memory efficient.
2016-05-23 21:08:07 +01:00
Paul Sokolovsky
53bac8e869
tests: Add testcase for str.center().
2016-05-22 00:18:53 +03:00
Paul Sokolovsky
719f8c044a
tests/struct1: Add testcase for an unknown type char.
2016-05-14 15:54:09 +03:00
Damien George
1e2f829293
tests/basics/string_splitlines: Reinstate feature test for splitlines.
2016-05-13 13:11:22 +01:00
Damien George
cc80c4dd59
py/objstr: Make dedicated splitlines function, supporting diff newlines.
...
It now supports \n, \r and \r\n as newline separators.
Adds 56 bytes to stmhal and 80 bytes to unix x86-64.
Fixes issue #1689 .
2016-05-13 12:21:32 +01:00
Damien George
65402ab1ec
py/mpz: Do Python style division/modulo within bignum divmod routine.
...
This patch consolidates the Python logic for division/modulo to one place
within the bignum code.
2016-05-08 22:21:21 +01:00
Damien George
dc3faea040
py/mpz: Fix bug with overflowing C-shift in division routine.
...
When DIG_SIZE=32, a uint32_t is used to store limbs, and no normalisation
is needed because the MSB is already set, then there will be left and
right shifts (in C) by 32 of a 32-bit variable, leading to undefined
behaviour. This patch fixes this bug.
2016-05-08 21:38:43 +01:00
Damien George
9e47c145c7
tests: Disable memoryview tests that overflow int conversion.
...
They fail on builds with 32-bit word size.
2016-05-07 22:36:49 +01:00
Damien George
470c429ee1
py/runtime: Properly handle passing user mappings to ** keyword args.
2016-05-07 22:02:46 +01:00
Damien George
12dd8df375
py/objstr: Binary type of str/bytes for buffer protocol is 'B'.
...
The type is an unsigned 8-bit value, since bytes objects are exactly
that. And it's also sensible for unicode strings to return unsigned
values when accessed in a byte-wise manner (CPython does not allow this).
2016-05-07 21:18:17 +01:00
Paul Sokolovsky
8c35f3979c
tests: Update for _io/_collections module having been renamed.
2016-05-02 14:15:11 +03:00
Paul Sokolovsky
0ea2108f1c
tests: Add testcase for yielding from a stopped generator.
2016-04-28 02:08:51 +03:00
Damien George
fea40ad468
py: Fix bug passing a string as a keyword arg in a dict.
...
Addresses issue #1998 .
2016-04-21 16:51:36 +01:00
Damien George
2c883c5ab7
tests: Fix dict1.py so it doesn't rely on the order of dict elems.
2016-04-15 16:28:33 +01:00
Damien George
7f7e247545
tests: Add .exp files for async tests, so they can run with Python 3.4.
2016-04-13 15:56:15 +01:00
Damien George
c33df193bf
tests: Add 6 tests for async await/for/with.
2016-04-13 15:27:06 +01:00
Damien George
04d5e644fc
py/objarray: Fix array.append so it doesn't extend if append fails.
...
Addresses issue #1965 .
2016-04-07 09:03:33 +01:00
Damien George
ab69ed7dac
tests: Split large tests into smaller files, to run with a small heap.
...
All tests in basics/ directory can now run and pass using 64-bit unix
port with only a 16k heap (./run-tests --heapsize 16k). Tests in this
directory should remain small so they can be used for ports with a
small heap.
2016-03-15 13:07:41 +00:00
Damien George
77f85db41e
py/objarray: Fix array slice assignment when array is reallocated.
...
Addresses issue #1898 .
2016-03-14 23:12:54 +00:00
Damien George
fbb3c190f9
tests: Remove commented out tests so test script is not too big.
2016-03-06 06:00:28 +02:00
Damien George
14848ffa12
tests: Reduce large object allocations so tests can run with small heap.
2016-03-06 05:59:46 +02:00
Paul Sokolovsky
e5cff5b223
tests/bytearray1: Add testcases for "in" operator.
2016-02-14 18:57:18 +02:00
Doug Currie
2e2e15cec2
py/mpz: Complete implementation of mpz_{and,or,xor} for negative args.
...
For these 3 bitwise operations there are now fast functions for
positive-only arguments, and general functions for arbitrary sign
arguments (the fast functions are the existing implementation).
By default the fast functions are not used (to save space) and instead
the general functions are used for all operations.
Enable MICROPY_OPT_MPZ_BITWISE to use the fast functions for positive
arguments.
2016-02-03 22:13:39 +00:00
pohmelie
e3a29de1dc
py/objstr: For str.format, add nested/computed fields support.
...
Eg: '{:{}}'.format(123, '>20')
@pohmelie was the original author of this patch, but @dpgeorge made
significant changes to reduce code size and improve efficiency.
2016-02-02 16:25:24 +00:00
Damien George
93bb7dffd2
py/vm: Fix popping of exception block in UNWIND_JUMP opcode.
...
Fixes issue #1812 .
2016-02-01 16:07:21 +00:00
Dave Hylands
a17755ee8b
py: Add ustruct.pack_into and unpack_from
2016-01-19 12:25:28 +00:00
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.
2016-01-14 21:15:18 +02:00
stijn
dea585f8ae
tests: Remove builtin_dict test
...
This is essentially a duplicate of obj_dict.py
2016-01-14 21:10:59 +02:00
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.
2016-01-04 13:13:39 +00:00
Paul Sokolovsky
ee7b8f32e3
tests/object_dict.py: Add test for obj.__dict__ .
2016-01-03 20:51:36 +02:00
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.
2016-01-03 20:51:26 +02:00
Dave Hylands
7281d95aee
py: Make dir report instance members
2016-01-03 20:37:18 +02:00
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 .
2015-12-26 12:41:31 +00:00
Damien George
8047340d75
py: Handle case of return within the finally block of try-finally.
...
Addresses issue #1636 .
2015-12-24 12:47:39 +00:00
Paul Sokolovsky
664bc44f30
tests: Add tests for %-formatting of bytes.
...
This requires CPython3.5, to not require switching to it, just use .exp
file.
2015-12-20 16:54:34 +02:00
Damien George
29e9db0c58
py: Fix compiler to handle lambdas used as default arguments.
...
Addresses issue #1709 .
2015-12-12 13:42:51 +00:00
Damien George
de2a2e296b
tests: Add test for "not" of a user defined class.
2015-12-10 22:21:57 +00:00
Damien George
3ff259a262
py: Fix calling of parent classmethod from instance of subclass.
...
Addresses issue #1697 .
2015-12-09 17:30:01 +00:00
Damien George
33ac0fd09f
py: Don't try to optimise for+range when args are not simple expressions.
...
Addresses issue #1693 .
2015-12-08 21:05:14 +00:00
Paul Sokolovsky
55995869e5
tests/builtin_minmax: Make compatible with @native codegen.
2015-12-07 19:32:48 +02:00
Paul Sokolovsky
36c6d2fa7d
tests/builtin_minmax: Add testcase for lazy iterable (generator).
2015-12-07 18:59:18 +02:00
pohmelie
e23d5a64cf
tests: Add min/max "default" agrument test
2015-12-07 18:56:25 +02:00
Damien George
7a99639cff
py: Fix function calls that have positional and a star-arg-with-iterator.
...
Addresses issue #1678 .
2015-12-03 17:59:49 +00:00
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.
2015-11-23 16:50:42 +00:00
Damien George
0e3f29cc99
py: Check that second argument to hasattr is actually a string.
...
Fixes issue #1623 .
2015-11-23 15:57:00 +00:00
Paul Sokolovsky
4120f32292
tests/int_big_*: Add more tests for result normalization.
...
Tested by comparability to small int/casting to bool.
2015-11-22 22:11:01 +02:00
Paul Sokolovsky
b56c635d64
tests/int_big_xor: Test that xor result is normalized.
...
And thus can be successfully used in comparisons, etc.
2015-11-22 22:02:15 +02:00
Damien George
2c83894257
py: Implement default and star args for lambdas.
2015-11-17 14:00:14 +00:00
Paul Sokolovsky
0bd3f3291d
tests/base/struct1.py: Add test for repetition counters.
2015-10-31 18:55:31 +03:00
Damien George
4bf3f2d3c0
py: Fix with+for+return bug by popping for-iter when unwinding exc stack.
...
Addresses issue #1182 .
2015-10-15 17:48:28 +01:00
Damien George
4300c7dba2
py: Remove dependency on printf/fwrite in mp_plat_print.
...
See issue #1500 .
2015-10-15 00:05:55 +01:00
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.
2015-10-08 13:15:07 +01:00
Damien George
7e12a601b8
py/compile: Fix edge case when constant-folding negation of integer.
...
Also adds tests specifically for testing constant folding.
2015-10-08 13:02:00 +01:00
Paul Sokolovsky
062bd81814
tests/basics/builtin_range: PEP8 fixes.
2015-10-05 20:02:52 +03:00
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.
2015-10-02 13:01:47 +01:00
Damien George
e5635f4ab3
py: Catch all cases of integer (big and small) division by zero.
2015-10-01 22:48:48 +01:00
Damien George
2065373f67
py/mpz: Fix bignum anding of large negative with smaller positive int.
2015-10-01 22:35:06 +01:00
Damien George
a81539db25
tests: Add further tests for mpz code.
2015-10-01 18:49:37 +01:00
Tom Soulanille
2a8a564fbd
tests: Test slicing a range that does not start at zero.
2015-09-28 14:01:20 +00:00
Delio Brignoli
e6978a4e26
py: Fix call args when a stararg is followed by keyword args.
2015-09-23 11:37:00 +01:00
Tom Soulanille
aeb62f9ae3
py/objslice: Make slice attributes (start/stop/step) readable.
...
Configurable with MICROPY_PY_BUILTINS_SLICE_ATTRS. Disabled by default.
2015-09-15 21:59:20 +01:00
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 .
2015-09-15 16:15:57 +01:00
Damien George
75a811a6df
tests: Move int+unicode test to unicode-specific test directory.
2015-09-07 21:36:24 +01:00
Damien George
558a016e2c
py/compile: Refine SyntaxError for repeated use of global/nonlocal.
2015-09-07 16:55:02 +01:00
Damien George
25afc7da0d
tests: Add tests to improve coverage of objstr.c.
2015-09-03 23:06:18 +01:00
Damien George
81794fcd31
py/binary: Add support for array('q') and array('Q').
2015-09-01 16:31:48 +01:00
Paul Sokolovsky
ab2594e341
tests: Add test for exception-chaining raise syntax.
2015-09-01 10:39:11 +03:00
Damien George
000730ecaa
py/objstr: Simplify error handling for bad conversion specifier.
2015-08-30 12:43:21 +01:00
Damien George
c2ec2ad8fb
tests: Add test where __getitem__ raises IndexError to stop iteration.
2015-08-30 11:49:59 +01:00
Damien George
b648e98ad0
py/objstr: Fix error reporting for unexpected end of modulo format str.
2015-08-29 23:13:51 +01:00
Damien George
7ef75f9f75
py/objstr: Fix error type for badly formatted format specifier.
...
Was KeyError, should be ValueError.
2015-08-29 23:13:51 +01:00
Damien George
1d350b8ac6
tests: Add a few tests for bool, bytearray, float to improve coverage.
2015-08-29 23:13:28 +01:00
Paul Sokolovsky
58d9b10d70
tests: Split byteorder-dependent tests to *_endian.py's.
2015-08-30 00:38:00 +03:00
Paul Sokolovsky
a160b70ced
tests: Add test on set/frozenset equality.
2015-08-28 22:42:01 +03:00
Paul Sokolovsky
8b3b2d04a8
objset: frozensets are hashable.
2015-08-28 22:31:52 +03:00
Damien George
d007cb8903
tests: Add more tests to improve coverage, mostly testing exceptions.
2015-08-21 12:02:09 +01:00
Damien George
9a2913ed1c
py/objlist: Make list += accept all arguments and add test.
2015-08-02 20:53:54 +01:00
Damien George
3900fed849
tests: Skip parser test if "compile" builtin is not available.
2015-07-24 22:37:26 +01:00
Damien George
96f0dd3cbc
py/parse: Fix handling of empty input so it raises an exception.
2015-07-24 15:05:56 +00:00
Damien George
d241c2a592
py/lexer: Raise SyntaxError when str hex escape sequence is malformed.
...
Addresses issue #1390 .
2015-07-23 23:20:37 +01:00
Delio Brignoli
32aba40830
py: Implement memoryview slice assignment.
...
Adds ability to do "memcpy" with memoryview objects, such as:
m1[0:3] = m2[2:5].
2015-07-20 15:53:22 +01:00
Sebastian Plamauer
1e8ca3a3cf
modbuiltins: Implement round() to precision.
2015-07-19 21:49:44 +03:00
Daniel Campora
d709622bd2
tests: Adapt basics/memoryerror.py for ports with lower heap sizes.
2015-06-24 15:25:59 +02:00
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 .
2015-06-20 16:39:39 +01:00
Damien George
e9ce00d874
py: Implement divmod for mpz bignum.
2015-06-13 23:38:28 +01:00
Damien George
7bab32ef89
tests: Add further tests for class defining __hash__.
2015-05-12 23:08:18 +01:00
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__".
2015-05-12 22:46:02 +01:00
Paul Sokolovsky
6738c1dded
vm: Properly handle StopIteration raised in user instance iterator.
...
I.e. in bytecode Python functions.
2015-05-11 23:57:42 +01:00
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]").
2015-05-10 00:41:49 +03:00
Damien George
9a42eb541e
py: Fix naming of function arguments when function is a closure.
...
Addresses issue #1226 .
2015-05-06 13:55:33 +01:00
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.
2015-05-05 22:48:19 +03:00
Paul Sokolovsky
3d3ef36e97
modstruct: Rename module to "ustruct", to allow full Python-level impl.
2015-05-04 16:53:52 +03:00
Damien George
47b9809d23
py: Check that arg to object.__new__ is a user-defined type.
...
Addresses issue #1203 .
2015-05-04 11:08:40 +01:00
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 .
2015-04-25 23:16:39 +01:00
Damien George
1f9e2188a6
tests: Add tests for attrtuple, and for more corner cases.
2015-04-22 16:52:03 +01:00
Damien George
d8cbbcaa9d
py: Fix builtin ord so that it can handle bytes values >= 0x80.
...
Addresses issue #1188 .
2015-04-19 12:26:46 +01:00
Damien George
90aa7595b4
tests: Convert line endings in fun_name.py from CRLF to LF.
2015-04-16 22:09:17 +01:00
Paul Sokolovsky
56beb01724
objarray: Support assignment of bytes to bytearray slice.
2015-04-16 00:51:12 +03:00
Paul Sokolovsky
8b7faa31e1
objstr: split(None): Fix whitespace properly.
2015-04-12 00:17:57 +03:00
Damien George
e5c4362a98
tests: Add some more tests to improve code coverage of corner cases.
2015-04-05 00:03:43 +01:00
Damien George
97abe22963
tests: Add tests to exercise lexer; and some more complex number tests.
2015-04-04 23:16:22 +01:00
Damien George
9dd3640464
tests: Add missing tests for builtins, and many other things.
2015-04-04 22:05:30 +01:00
Paul Sokolovsky
620058cc57
tests: Add test for str.splitlines().
2015-04-04 00:09:54 +03:00
Paul Sokolovsky
ad038ca101
tests/class_descriptor.py: Fix line-endings (were CRLF).
2015-03-28 01:07:00 +02:00
stijn
28fa84b445
py: Add optional support for descriptors' __get__ and __set__ methods.
...
Disabled by default. Enabled on unix and windows ports.
2015-03-26 23:55:14 +00:00
Damien George
23d7fd526d
tests: Skip some new tests when testing native emitter.
2015-03-25 23:33:48 +00:00
Damien George
214179b430
tests: Add tests for SyntaxError, TypeError, and other missing things.
...
This is intended to improve coverage of the test suite.
2015-03-25 23:10:09 +00:00
stijn
3cc17c69ff
py: Allow retrieving a function's __name__.
...
Disabled by default. Enabled on unix and stmhal ports.
2015-03-20 23:13:32 +00:00
Paul Sokolovsky
d48035b06b
tests: Add basic test for OrderedDict.
...
Mostly to have coverage of newly added code in map.c.
2015-03-20 17:26:10 +00:00
Damien George
6837d46c1d
py: Fix builtin abs so it works for bools and bignum.
2015-03-14 22:07:30 +00:00
Damien George
26a9975fba
tests: Add some more tests for bytes, bignum, string and ujson.
2015-03-14 21:20:58 +00:00
Damien George
af43565322
tests: Add tests for things that are not already tested.
...
The aim here is to improve coverage of the code.
2015-03-12 22:48:45 +00:00
Peter D. Gray
b2a237d337
py: Add support for start/stop/step attributes of builtin range object.
2015-03-11 20:02:06 +00:00
Damien George
086a7616dd
tests: Add tests for boundmeth; and bignum cmp, unary, float, error.
2015-03-03 16:45:39 +00:00
Damien George
f2a889564b
tests: Add basics test for gc module.
2015-03-02 18:30:17 +00:00
Damien George
fe3da09fa0
tests: Use range as iterable instead of list comprehension.
...
So that navite emitter passes (comprehensions use yield which is not yet
supported by native emitter).
2015-03-02 17:55:55 +00:00
Damien George
24ffb8e876
tests: Add tests for builtins: all, any, sum, abs.
2015-03-02 17:21:10 +00:00
Damien George
2af921fb51
tests: Add tests for op special meths, ubinascii, complex.
2015-03-02 12:47:44 +00:00
Paul Sokolovsky
992284be39
tests: Add test for array slice assignment.
2015-02-27 22:17:24 +02:00
Damien George
ed8b4da0db
tests: Remove obsolete test; don't use fp in micropython/ tests.
2015-02-15 01:57:39 +00:00
Damien George
f6532bb9e0
py: Simplify and remove redundant code for __iter__ method lookup.
2015-02-15 01:10:13 +00:00
stijn
c1832fd206
py: Add setattr builtin.
2015-02-14 23:35:00 +00:00
Damien George
48244044a2
py: Allow subclass of native object to delegate to the native buffer_p.
...
Addresses issue #1109 .
2015-02-09 15:08:00 +00:00
Paul Sokolovsky
194117a066
objstr: Fix bytes creation from array of long ints.
2015-02-09 12:11:49 +08:00
Damien George
7d414a1b52
py: Parse big-int/float/imag constants directly in parser.
...
Previous to this patch, a big-int, float or imag constant was interned
(made into a qstr) and then parsed at runtime to create an object each
time it was needed. This is wasteful in RAM and not efficient. Now,
these constants are parsed straight away in the parser and turned into
objects. This allows constants with large numbers of digits (so
addresses issue #1103 ) and takes us a step closer to #722 .
2015-02-08 01:57:40 +00:00
Damien George
744e767458
py: Make list.sort keep stack usage within O(log(N)) bound.
...
Also fix list.sort so it works with user-defined types, and parse the
keyword arguments properly.
Addresses issue #338 .
2015-02-02 15:14:22 +00:00
Damien George
32bade19d9
py: Convert CR to LF and CR LF to LF in lexer.
...
Only noticeable difference is how newlines are encoded in triple-quoted
strings. The behaviour now matches CPython3.
2015-01-30 00:27:46 +00:00
Damien George
92ab95f215
tests: Add some tests to improve coverage.
2015-01-29 14:56:09 +00:00
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
Paul Sokolovsky
57aebe1714
tests: Add testcase for bytes() on values in range 128-255.
2015-01-28 22:29:51 +02:00
Damien George
a9dc9b8f6d
py: Fix comparison of minus-zero long int.
2015-01-27 17:47:38 +00:00
Damien George
962a5d50c9
py: Implement __reversed__ slot.
...
Addresses issue #1073 .
2015-01-21 00:19:42 +00:00
Damien George
1e1779eacf
py: Reluctantly add an extra pass to bytecode compiler.
...
Bytecode also needs a pass to compute the stack size. This is because
the state size of the bytecode function is encoded as a variable uint,
so we must know the value of this uint before we encode it (otherwise
the size of the generated code changes from one pass to the next).
Having an entire pass for this seems wasteful (in time). Alternative is
to allocate fixed space for the state size (would need 3-4 bytes to be
general, when 1 byte is usually sufficient) which uses a bit of extra
RAM per bytecode function, and makes the code less elegant in places
where this uint is encoded/decoded.
So, for now, opt for an extra pass.
2015-01-14 00:20:28 +00:00
Damien George
4c81ba8015
py: Never intern data of large string/bytes object; add relevant tests.
...
Previously to this patch all constant string/bytes objects were
interned by the compiler, and this lead to crashes when the qstr was too
long (noticeable now that qstr length storage defaults to 1 byte).
With this patch, long string/bytes objects are never interned, and are
referenced directly as constant objects within generated code using
load_const_obj.
2015-01-13 16:21:23 +00:00
Damien George
c38dc3ccc7
py: Implement fallback for equality check for all types.
...
Return "not equal" for objects that don't implement equality check.
This is as per Python specs.
2015-01-11 15:13:18 +00:00
Damien George
c33ecb83ba
tests: Add test for when instance member overrides class member.
2015-01-08 17:48:44 +00:00
Damien George
19b3fea6a8
tests: Separate out test cases that rely on float support to float/ dir.
2015-01-08 15:41:37 +00:00
Paul Sokolovsky
343ca1e63a
objarray: Make sure that longint works as bytearray size.
2015-01-04 17:19:16 +02:00
Paul Sokolovsky
c114496641
objstr: Implement kwargs support for str.format().
2015-01-04 00:26:31 +02:00
stijn
021dc44009
py: Allow keyword arguments for namedtuple
2015-01-01 14:53:23 +02:00
stijn
12340147b0
py: Use sequence of strings for named tuple initialization
...
- remove single string initialization style
- take list of strings instead
- store list in the type for fast lookup
2015-01-01 14:53:23 +02:00