Commit Graph

2354 Commits

Author SHA1 Message Date
Chris Angelico
24371c7267 Break out index-to-pointer calculation into a function 2014-06-10 02:10:22 +10:00
Chris Angelico
616c24ac01 Add tests of string slicing, which currently fail 2014-06-10 02:03:11 +10:00
Chris Angelico
a24d19f676 Change string indexing to not precalculate the charlen, and add test for neg indexing 2014-06-10 01:59:46 +10:00
Chris Angelico
0bcc7ab89e Clean up constant qstr declarations now that charlen isn't needed 2014-06-08 22:09:17 +10:00
Chris Angelico
5473e1a1db Remove the charlen field from strings, calculating it when required 2014-06-08 07:18:42 +10:00
Chris Angelico
5c1658ec71 Get rid of mp_obj_str_get_data_len() which was used in only one place 2014-06-08 07:11:27 +10:00
Chris Angelico
a019ba968b Add a unichar_charlen() function to calculate length-in-characters from length-in-bytes 2014-06-08 06:58:26 +10:00
Chris Angelico
44b0d5cff8 Use utf8_get/next_char in building up a string's repr 2014-06-08 06:32:44 +10:00
Chris Angelico
30d1bad33f Make utf8_get_char() and utf8_next_char() actually do what their names say 2014-06-08 06:32:21 +10:00
Chris Angelico
bc990dad9a Revert "Add PEP 393-flags to strings and stub usage."
This reverts commit c239f50952.
2014-06-08 02:10:59 +10:00
Chris Angelico
f9bebb28ad Whitespace fixes 2014-06-07 15:41:48 +10:00
Chris Angelico
279de0c8eb Formatting/layout improvements - introduce macros for UTF-8 byte detection, add braces. No functional changes. 2014-06-07 15:28:35 +10:00
Chris Angelico
f1911f53d5 Make chr() Unicode-aware 2014-06-07 11:56:02 +10:00
Chris Angelico
f51ad737b4 Make a string's repr Unicode-aware 2014-06-07 11:50:43 +10:00
Chris Angelico
01bd686846 Expand the Unicode tests 2014-06-07 11:44:58 +10:00
Chris Angelico
7bc91904f8 Record byte lengths for byte strings 2014-06-07 11:44:58 +10:00
Chris Angelico
bb13212071 Make ord() Unicode-aware 2014-06-07 11:44:58 +10:00
Chris Angelico
03f0cbe905 Retain characters as UTF-8 encoded Unicode 2014-06-07 11:34:28 +10:00
Chris Angelico
e924659b85 Add support for \u and \U escapes, but not \N (with explanatory comment) 2014-06-07 11:34:28 +10:00
Chris Angelico
231031ac5f Add character length to qstr 2014-06-07 11:34:28 +10:00
Chris Angelico
6df1b946fb Add test of UTF-8 encoded source file resulting in properly formed string 2014-06-07 11:34:28 +10:00
Chris Angelico
16429b81a8 Make len(s) return character length (even though creation's still buggy) 2014-06-07 11:34:28 +10:00
Chris Angelico
cd2cf6663c HACK - When indexing a qstr, count its charlen. Stupidly inefficient but POC.
All tests pass now, though string creation is still buggy.
2014-06-07 11:34:28 +10:00
Chris Angelico
47c234584d objstr: Record character length separately from byte length
CAUTION: Buggy, may crash stuff - qstr needs equivalent functionality too
2014-06-07 11:34:28 +10:00
Chris Angelico
b0f41c72af Beginnings of UTF-8 support - construct strings from that many UTF-8-encoded chars, and subscript bytes the same way 2014-06-07 11:34:27 +10:00
Chris Angelico
89452be641 Update comments - now aiming for UTF-8 rather than PEP 393 strings 2014-06-07 11:34:27 +10:00
Chris Angelico
c239f50952 Add PEP 393-flags to strings and stub usage.
The test suite all passes, but nothing has actually been changed.
2014-06-07 11:34:27 +10:00
Damien George
c61be8e1e1 Merge pull request #662 from stinos/windows-pathsep
unix: Fix path seperator used depending on OS
2014-06-07 00:05:59 +01:00
Paul Sokolovsky
180751fbf3 Merge pull request #670 from Rosuav/stringhash
Bring the C and Python compute_hash functions into consistency
2014-06-07 00:10:10 +03:00
Chris Angelico
de09caaa37 Bring the C and Python compute_hash functions into consistency 2014-06-07 07:06:18 +10:00
Paul Sokolovsky
d72bc2713a objint: Fix corner case in buffer access. 2014-06-06 23:08:37 +03:00
Paul Sokolovsky
b56a53dfd6 Merge pull request #667 from Rosuav/testfixes
A couple of small fixes to run-tests
2014-06-06 22:23:23 +03:00
Paul Sokolovsky
8c75bd26e2 Merge pull request #668 from dhylands/print-prec
Fix str.modulo when precision is specified.
2014-06-06 22:12:42 +03:00
Dave Hylands
b69f9fa31f Fix str.modulo when precision is specified. 2014-06-05 23:09:02 -07:00
Paul Sokolovsky
380f147d2e modgc: Real 64-bit cleanness. 2014-06-06 03:01:39 +03:00
Paul Sokolovsky
a3ef8087e8 modgc: 64-bit cleanness. 2014-06-06 02:34:17 +03:00
Chris Angelico
047db2299c Turn the Travis CI test skipping mechanism into something more generic 2014-06-06 07:51:01 +10:00
Chris Angelico
88b11b50e5 Figure out the test_name before using it (significant only to Travis skips) 2014-06-06 07:51:01 +10:00
Paul Sokolovsky
755a55f507 modgc: Implement return value for gc.collect(), enable on Unix. 2014-06-05 22:48:02 +03:00
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).
2014-06-05 19:44:54 +01:00
Paul Sokolovsky
f675ff3957 Merge pull request #665 from Rosuav/naming3.3
Change comments (mainly URLs) to no longer specifically say Python 3.3
2014-06-05 21:17:46 +03:00
Damien George
11de8399fe py: Small changes to objstr.c, including a bug fix.
Some small fixed:

- Combine 'x' and 'X' cases in str format code.

- Remove trailing spaces from some lines.

- Make exception messages consistently begin with lower case (then
needed to change those in objarray and objtuple so the same
constant string data could be used).

- Fix bug with exception message having %c instead of %%c.
2014-06-05 18:57:38 +01:00
Chris Angelico
daf973ae00 Change comments (mainly URLs) to no longer specifically say Python 3.3 2014-06-06 03:51:03 +10:00
Damien George
c074cd38c3 Merge pull request #663 from Rosuav/floatpercentx
Remove tests that fail under CPython 3.5
2014-06-05 18:39:08 +01: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
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.
2014-06-05 22:34:11 +10:00
stijn
df3ab07994 unix: Fix path seperator used depending on OS
';' is the standard seperator used for paths in environment variables on Windows
2014-06-05 12:34:41 +02:00
Paul Sokolovsky
1e82ef3ae8 Merge pull request #660 from Rosuav/assert0
Replace assert(0) with a self-documenting TODO string
2014-06-05 12:11:48 +03:00
Paul Sokolovsky
76c8a4c91b unix: Add setjmp-based GC register helper implementation.
As I suspected for a long time, for x86, register helper doesn't really make
any difference - there's simply not enough register to keep anything in
them for any prolonged time. Anything gets pushed on stack anyway. So, on
x86, uPy passed all tests even with empty reg helper. So, this setjmp
implementation goes as "untested".
2014-06-05 04:32:17 +03:00
Chris Angelico
9ab8ab2117 Replace assert(0) with a self-documenting TODO string 2014-06-05 06:05:57 +10:00