Damien George
0528c5a22a
py: In str unicode, str_subscr will never be passed a bytes object.
2015-04-04 19:42:03 +01:00
Paul Sokolovsky
ac2f7a7f6a
objstr: Add .splitlines() method.
...
splitlines() occurs ~179 times in CPython3 standard library, so was
deemed worthy to implement. The method has subtle semantic differences
from just .split("\n"). It is also defined as working for any end-of-line
combination, but this is currently not implemented - it works only with
LF line-endings (which should be OK for text strings on any platforms,
but not OK for bytes).
2015-04-04 00:09:48 +03:00
Damien George
2e2e404ff7
py: Allow to compile with extra warnings (sign-compare, unused-param).
2015-03-19 00:25:33 +00:00
Damien George
98e3a64694
py: Remove duplicated mp_obj_str_make_new function from objstrunicode.c.
2015-01-28 14:14:57 +00:00
Paul Sokolovsky
344e15b1ae
objstr: Remove code duplication and unbreak Windows build.
...
There was really weird warning (promoted to error) when building Windows
port. Exact cause is still unknown, but it uncovered another issue:
8-bit and unicode str_make_new implementations should be mutually exclusive,
and not built at the same time. What we had is that bytes_decode() pulled
8-bit str_make_new() even for unicode build.
2015-01-23 02:15:56 +02:00
Paul Sokolovsky
6113eb2f33
objstr*: Use separate names for locals_dict of 8-bit and unicode str's.
...
To somewhat unbreak -DSTATIC="" compile.
2015-01-23 02:05:58 +02:00
Damien George
0b9ee86133
py: Add mp_obj_new_str_from_vstr, and use it where relevant.
...
This patch allows to reuse vstr memory when creating str/bytes object.
This improves memory usage.
Also saves code ROM: 128 bytes on stmhal, 92 bytes on bare-arm, and 88
bytes on unix x64.
2015-01-21 23:17:27 +00:00
Damien George
ff8dd3f486
py, unix: Allow to compile with -Wunused-parameter.
...
See issue #699 .
2015-01-20 12:47:20 +00:00
Damien George
51dfcb4bb7
py: Move to guarded includes, everywhere in py/ core.
...
Addresses issue #1022 .
2015-01-01 20:32:09 +00:00
Paul Sokolovsky
e62a0fe367
objstr: Allow to convert any buffer proto object to str.
...
Original motivation is to support converting bytearrays, but easier to just
support buffer protocol at all.
2014-10-31 00:03:53 +02:00
Damien George
cde0ca21bf
py: Simplify JSON str printing (while still conforming to JSON spec).
...
The JSON specs are relatively flexible and allow us to use one function
to print strings, be they ascii, bytes or utf-8 encoded.
2014-09-25 17:35:56 +01:00
Damien George
612045f53f
py: Add native json printing using existing print framework.
...
Also add start of ujson module with dumps implemented. Enabled in unix
and stmhal ports. Test passes on both.
2014-09-17 22:56:34 +01:00
Damien George
4abff7500f
py: Change uint to mp_uint_t in runtime.h, stackctrl.h, binary.h.
...
Part of code cleanup, working towards resolving issue #50 .
2014-08-30 14:59:21 +01:00
Damien George
ecc88e949c
Change some parts of the core API to use mp_uint_t instead of uint/int.
...
Addressing issue #50 , still some way to go yet.
2014-08-30 00:35:11 +01:00
Damien George
bb4c6f35c6
py: Make MP_OBJ_NEW_SMALL_INT cast arg to mp_int_t itself.
...
Addresses issue #724 .
2014-07-31 10:49:14 +01:00
Damien George
40f3c02682
Rename machine_(u)int_t to mp_(u)int_t.
...
See discussion in issue #50 .
2014-07-03 13:25:24 +01:00
Paul Sokolovsky
9e215fa4c2
py: Make unichar_charlen() accept/return machine_uint_t.
2014-06-28 23:15:29 +03:00
Damien George
e04a44e2f6
py: Small comments, name changes, use of machine_int_t.
2014-06-28 10:27:23 +01:00
Paul Sokolovsky
ea2c936c7e
objstrunicode: Refactor str_index_to_ptr() following objstr.
2014-06-27 00:04:20 +03:00
Paul Sokolovsky
00c904b47a
objstrunicode: Signedness issues.
2014-06-27 00:04:19 +03:00
Paul Sokolovsky
79b7fe2ee5
objstrunicode: Implement iterator.
2014-06-27 00:04:19 +03:00
Paul Sokolovsky
cdc020da4b
objstrunicode: Re-add buffer protocol back for now, required for io.StringIO.
2014-06-27 00:04:18 +03:00
Paul Sokolovsky
e7f2b4c875
objstrunicode: Revamp len() handling for unicode, and optimize bool().
2014-06-27 00:04:18 +03:00
Paul Sokolovsky
86d3898e70
objstrunicode: Get rid of bytes checking, it's separate type.
2014-06-27 00:04:18 +03:00
Paul Sokolovsky
9731912ccb
py: Prune unneeded code from objstrunicode, reuse code in objstr.
2014-06-27 00:04:18 +03:00