Damien George
02d95d7ce9
py: Fix 2 bugs in native emitter: jump_or_pop and stack settling.
...
Addresses issue #838 .
2014-08-29 20:05:32 +01:00
Dave Hylands
b7f7c655ed
Make int(b'123') work properly.
2014-08-26 19:15:04 -07:00
Damien George
779794a680
py: Add dispatch for user defined ==, >, <=, >=.
...
Addresses issue #827 .
2014-08-26 09:31:26 +01:00
Damien George
7310fd469a
py: Consolidate min/max functions into one, and add key= argument.
...
Addresses issue #811 .
2014-08-24 19:14:09 +01:00
Damien George
9b7a8ee8f1
py: Fix mult by negative number of tuple, list, str, bytes.
...
Multiplication of a tuple, list, str or bytes now yields an empty
sequence (instead of crashing). Addresses issue #799
Also added ability to mult bytes on LHS by integer.
2014-08-13 13:22:24 +01:00
Damien George
bb91f1195a
py: Improve range: add len, subscr, proper print.
...
Can now index ranges with integers and slices, and reverse ranges
(although reversing is not very efficient).
Not sure how useful this stuff is, but gets us closer to having all of
Python's builtins.
2014-08-12 19:41:18 +01:00
Damien George
4c03b3a899
py: Implement builtin reversed() function.
...
reversed function now implemented, and works for tuple, list, str, bytes
and user objects with __len__ and __getitem__.
Renamed mp_builtin_len to mp_obj_len to make it publically available (eg
for reversed).
2014-08-12 18:33:40 +01:00
Paul Sokolovsky
9749b2fb0d
objstr: Make sure that bytes are indexed as bytes, not as unicode.
...
Fixes #795 .
2014-08-11 22:38:00 +03:00
Paul Sokolovsky
5f930337bc
objarray: Implement equality testing between arrays and other buffers.
2014-08-10 16:22:57 +03:00
Damien George
539681fffd
tests: Rename test scripts, changing - to _ for consistency.
...
From now on, all new tests must use underscore.
Addresses issue #727 .
2014-07-05 06:14:29 +01:00
Damien George
0182385ab0
py: Automatically ake __new__ a staticmethod.
...
Addresses issue #622 .
2014-07-05 05:55:00 +01:00
Paul Sokolovsky
7a2f166949
modstruct: Fix alignment handling issues.
...
Also, factor out mp_binary_get_int() function.
2014-06-25 23:34:44 +03:00
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).
2014-06-14 01:21:13 +03:00
Paul Sokolovsky
f4bf065dac
tests: Add testcases for "complicated" args to generator functions.
2014-06-11 20:43:47 +03:00
Damien George
58cbb4d661
py: Implement __contains__ special method.
2014-06-10 23:07:56 +01:00
Paul Sokolovsky
195de3247b
objtype: Fix passing of class param to inherited classmethods.
...
This is getting more and more tangled, but that's old news.
2014-06-08 22:28:44 +03:00
Damien George
9e951498b2
tests: Add more tests for default keyword-only args.
2014-06-08 12:58:32 +01:00
Damien George
c06427c019
tests: Fix default arg test.
2014-06-08 00:12:32 +01:00
Paul Sokolovsky
b4efac14cd
py: Make sure getattr() works with non-interned strings (by interning them).
2014-06-08 01:15:06 +03:00
Damien George
f0778a7ccb
py: Implement default keyword only args.
...
Should finish addressing issue #524 .
2014-06-07 22:01:00 +01:00
Dave Hylands
b69f9fa31f
Fix str.modulo when precision is specified.
2014-06-05 23:09:02 -07:00
Chris Angelico
daf973ae00
Change comments (mainly URLs) to no longer specifically say Python 3.3
2014-06-06 03:51:03 +10:00
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.
2014-06-05 20:06:15 +03:00
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 .
2014-06-03 12:53:44 +01:00
Damien George
5b5562c1d1
py: Fix stack underflow with optimised for loop.
2014-05-31 17:59:11 +01:00
Damien George
049a01d148
tests: Add another test for break-from-for-loop.
2014-05-31 16:56:15 +01:00
Kim Bauters
a3f4b83018
add methods isspace(), isalpha(), isdigit(), isupper() and islower() to str
2014-05-31 07:30:57 +01:00
Paul Sokolovsky
ccd0e0afcd
tests: Add test for break in for.
...
For #635 / 25c84643b6
.
2014-05-31 00:43:41 +03:00
Paul Sokolovsky
8827682b35
objstr: *strip(): If nothing is stripped, don't create dup string.
2014-05-30 03:15:17 +03:00
Paul Sokolovsky
bcdffe53c6
objstr: *strip(): Fix handling of one-char subject strings.
2014-05-30 03:15:17 +03:00
Damien George
f55cf10101
py: Implement bignum '&' with negatives on lhs and rhs.
...
Needs proper coverage testing. Doesn't implement -ve & -ve.
Addresses issue #611 .
2014-05-29 15:01:49 +01:00
Paul Sokolovsky
d07bf029b7
tests: Add small testcase for 3-arg slices.
2014-05-26 02:02:47 +03:00
Paul Sokolovsky
5fd5af98d0
objlist: Implement support for arbitrary (3-arg) slices.
2014-05-25 22:12:56 +03:00
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).
2014-05-25 02:36:12 +03:00
Paul Sokolovsky
d098c6bf85
objstr: Implement .endswith().
2014-05-24 22:46:51 +03:00
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.
2014-05-22 00:32:00 +03:00
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 .
2014-05-21 22:27:03 +03:00
Damien George
0fd01683c6
Merge pull request #607 from Anton-2/osx-clang
...
Allow compilation of unix port under clang on OS X
2014-05-21 19:51:05 +01:00
Paul Sokolovsky
66ab571cca
tests: Update subclass-native2.py for __new__/__init__ refactor.
...
Now case of subclassing tuple works, and list is broken, see comments.
2014-05-19 21:56:07 +03:00
Paul Sokolovsky
c18ef2a9dd
objstr: startswith(): Accept optional "start" arg.
2014-05-15 21:33:18 +03:00
Paul Sokolovsky
70328e419a
py: Implement more complete bytes comparison handling.
2014-05-15 20:58:40 +03:00
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?
2014-05-15 19:09:06 +03:00
Paul Sokolovsky
2a27365854
objstr.c: Partial implementation of .rsplit().
...
sep=None is TODO.
2014-05-14 02:42:20 +03:00
Paul Sokolovsky
7074f25768
tests/int-long.py: Try to expose issue with recent "&" optimization.
2014-05-13 08:24:54 +03:00
Damien George
561e425903
py: Fix bug in mpz_and function.
...
Addresses issue #610 .
2014-05-12 23:27:29 +01:00
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.
2014-05-12 23:45:50 +03:00
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.
2014-05-12 00:13:10 +02:00
Paul Sokolovsky
5ebd5f0f19
objstr: Slice indexing: support bytes properly.
2014-05-11 21:22:59 +03:00
Paul Sokolovsky
bfb8819c0c
objstr: Make .split() support bytes.
2014-05-11 21:17:28 +03:00
Paul Sokolovsky
5e5d69b35e
objstr: Make .join() support bytes.
2014-05-11 21:13:01 +03:00