Paul Sokolovsky
59ced651b5
bench: Add test for map() vs inplace operations in array-likes.
map() is 5 times slower. That's mostly because of inefficiency of creating
containers from iterables of unknown length (like map()).
11 years ago
Paul Sokolovsky
17db096505
bench: Add tests for constructing various containers from iterator.
Both "bound" (like, length known) and "unbound" (length unknown) are tested.
All of list, tuple, bytes, bytesarray offer approximately the same
performance, with "unbound" case being 30 times slower.
11 years ago
Paul Sokolovsky
e53d2197e4
bench: Add test for function call overhead.
For a trivial operation, calling a function is 5 times slower than doing
operation inline.
11 years ago
Paul Sokolovsky
2ec38a17d4
objstr: Be 8-bit clean even for repr().
This will allow roughly the same behavior as Python3 for non-ASCII strings,
for example, print("<phrase in non-Latin script>".split()) will print list
of words, not weird hex dump (like Python2 behaves). (Of course, that it
will print list of words, if there're "words" in that phrase at all, separated
by ASCII-compatible whitespace; that surely won't apply to every human
language in existence).
11 years ago
Paul Sokolovsky
fbdf2f1d63
py: Rename builtin "io" to "_io".
Functionality we provide in builtin io module is fairly minimal. Some
code, including CPython stdlib, depends on more functionality. So, there's
a choice to either implement it in C, or move it _io, and let implement other
functionality in Python. 2nd choice is pursued. This setup matches CPython
too (_io is builtin, io is Python-level).
11 years ago
Paul Sokolovsky
f4bf065dac
tests: Add testcases for "complicated" args to generator functions.
11 years ago
Damien George
58cbb4d661
py: Implement __contains__ special method.
11 years ago
Paul Sokolovsky
195de3247b
objtype: Fix passing of class param to inherited classmethods.
This is getting more and more tangled, but that's old news.
11 years ago
Damien George
4297fed1c3
tests: Run 'micropython' tests on pyboard.
11 years ago
Damien George
9e951498b2
tests: Add more tests for default keyword-only args.
11 years ago
Damien George
c06427c019
tests: Fix default arg test.
11 years ago
Paul Sokolovsky
b4efac14cd
py: Make sure getattr() works with non-interned strings (by interning them).
11 years ago
Damien George
f0778a7ccb
py: Implement default keyword only args.
Should finish addressing issue #524 .
11 years ago
Dave Hylands
b69f9fa31f
Fix str.modulo when precision is specified.
11 years ago
Chris Angelico
047db2299c
Turn the Travis CI test skipping mechanism into something more generic
11 years ago
Chris Angelico
88b11b50e5
Figure out the test_name before using it (significant only to Travis skips)
11 years ago
Damien George
d4c2bddd0c
py: Raise TypeError when trying to format non-int with %x,%o,%X.
This behaviour follows Python 3.5 standard (in 3.4 it's a
DeprecationWarning which we'd rather make a TypeError).
11 years ago
Chris Angelico
daf973ae00
Change comments (mainly URLs) to no longer specifically say Python 3.3
11 years ago
Paul Sokolovsky
75ce9256b2
objstr: Implement "%(key)s" % {} formatting for strings and dicts.
Also, make sure that args to "*" format specifiers are bounds-checked
properly and don't lead for segfaults in case of mismatch.
11 years ago
Chris Angelico
7a6e09635a
Remove tests that fail under CPython 3.5
See http://bugs.python.org/issue19995 for rationale. As micropython currently
aims for Python 3.3 compatibility I have not changed behaviour, but this
change allows the test suite to be run against a newer Python without having
spurious failures.
11 years ago
Damien George
bcb6ca4d5e
py: Implement full behaviour of dict.update(), and dict().
Add keyword args to dict.update(), and ability to take a dictionary as
argument.
dict() class constructor can now use dict.update() directly.
This patch loses fast path for dict(other_dict), but is that really
needed? Any anyway, this idiom will now re-hash the dictionary, so is
arguably more memory efficient.
Addresses issue #647 .
11 years ago
Damien George
4d659f566f
tests: Add feature test for when heap allocation is disabled.
11 years ago
Damien George
a053e37b2c
tests: Change --test_dirs to --test-dirs.
11 years ago
Damien George
5b5562c1d1
py: Fix stack underflow with optimised for loop.
11 years ago
Damien George
049a01d148
tests: Add another test for break-from-for-loop.
11 years ago
Kim Bauters
a3f4b83018
add methods isspace(), isalpha(), isdigit(), isupper() and islower() to str
11 years ago
Paul Sokolovsky
ccd0e0afcd
tests: Add test for break in for.
For #635 / 25c84643b6
.
11 years ago
Paul Sokolovsky
8827682b35
objstr: *strip(): If nothing is stripped, don't create dup string.
11 years ago
Paul Sokolovsky
bcdffe53c6
objstr: *strip(): Fix handling of one-char subject strings.
11 years ago
Damien George
f55cf10101
py: Implement bignum '&' with negatives on lhs and rhs.
Needs proper coverage testing. Doesn't implement -ve & -ve.
Addresses issue #611 .
11 years ago
stijn
8ac3b578e5
tests: Add argument to allow specifying which directories to test
11 years ago
Paul Sokolovsky
d07bf029b7
tests: Add small testcase for 3-arg slices.
11 years ago
Paul Sokolovsky
5fd5af98d0
objlist: Implement support for arbitrary (3-arg) slices.
11 years ago
Paul Sokolovsky
2705f4c782
objlist: Implement growing slice assignment.
This means that complete slice operations are supported for lists (but not
for bytearray's and array.array's).
11 years ago
Paul Sokolovsky
d098c6bf85
objstr: Implement .endswith().
11 years ago
Paul Sokolovsky
806ea1f6ca
py: Initial attempts to actually allow implementing __new__ in Python.
Caveat is that __new__ should recurse to base class __new__, and ultimately,
object.__new__ is what handles instance allocation.
11 years ago
Paul Sokolovsky
a8408a8abe
objtype: super: Fall back to "object" lookup as last resort.
Also, define object.__init__() (semantically empty, purely CPython compat
measure). Addresses #520 .
11 years ago
Paul Sokolovsky
66ab571cca
tests: Update subclass-native2.py for __new__/__init__ refactor.
Now case of subclassing tuple works, and list is broken, see comments.
11 years ago
Paul Sokolovsky
c18ef2a9dd
objstr: startswith(): Accept optional "start" arg.
11 years ago
Paul Sokolovsky
70328e419a
py: Implement more complete bytes comparison handling.
11 years ago
Paul Sokolovsky
ad3baec12f
sequence: Fix yet another case of improper sequence comparison.
This time, in mp_seq_cmp_bytes(). How many more cases are still lurking?
11 years ago
Paul Sokolovsky
2a27365854
objstr.c: Partial implementation of .rsplit().
sep=None is TODO.
11 years ago
Paul Sokolovsky
7074f25768
tests/int-long.py: Try to expose issue with recent "&" optimization.
11 years ago
Damien George
561e425903
py: Fix bug in mpz_and function.
Addresses issue #610 .
11 years ago
Paul Sokolovsky
df94b717b4
modstruct: Implement count specifier for strings (e.g. "100s").
Infra for counts of other types is there, need last mile to be implemented.
11 years ago
Antonin ENFRUN
1b901c320b
tests: create result file for test/basics/memoryerror.py .
On Mac OS "python3 test/basics/memoryerror.py" never runs out of memory, the process is frozen by the os before.
11 years ago
Paul Sokolovsky
5ebd5f0f19
objstr: Slice indexing: support bytes properly.
11 years ago
Paul Sokolovsky
bfb8819c0c
objstr: Make .split() support bytes.
11 years ago
Paul Sokolovsky
5e5d69b35e
objstr: Make .join() support bytes.
11 years ago
Paul Sokolovsky
ff30666c69
py: Add basic implementation of hasattr() function.
11 years ago