summaryrefslogtreecommitdiffstatshomepage
path: root/py/objstr.c
Commit message (Collapse)AuthorAge
* py: Make bytes objs work with more str methods; add tests.Damien George2014-12-24
|
* py: Use str_to_int function in more places to reduce code size.Damien George2014-12-21
|
* py: Fix function type: () -> (void).Damien George2014-12-10
|
* py: Allow bytes/bytearray/array to be init'd by buffer protocol objects.Damien George2014-12-04
| | | | | | | Behaviour of array initialisation is subtly different for bytes, bytearray and array.array when argument has buffer protocol. This patch gets us CPython conformant (except we allow initialisation of array.array by buffer with length not a multiple of typecode).
* py: #if guard str_make_new when not needed.Damien George2014-11-27
|
* py: Use shorter, static error msgs when ERROR_REPORTING_TERSE enabled.Damien George2014-11-06
| | | | | | | | Going from MICROPY_ERROR_REPORTING_NORMAL to MICROPY_ERROR_REPORTING_TERSE now saves 2020 bytes ROM for ARM Thumb2, and 2200 bytes ROM for 32-bit x86. This is about a 2.5% code size reduction for bare-arm.
* py: Allow bytes object as argument to some str methods.Damien George2014-11-05
| | | | | | This turns failing assertions to type exceptions for things like b"123".find(...). We still don't support operations like this on bytes objects (unlike CPython), but at least it no longer crashes.
* py: Allow +, in, and compare ops between bytes and bytearray/array.Damien George2014-11-05
| | | | | | Eg b"123" + bytearray(2) now works. This patch actually decreases code size while adding functionality: 32-bit unix down by 128 bytes, stmhal down by 84 bytes.
* objstr: Allow to convert any buffer proto object to str.Paul Sokolovsky2014-10-31
| | | | | Original motivation is to support converting bytearrays, but easier to just support buffer protocol at all.
* py: mp_obj_str_get_str(): Work with bytes too.Paul Sokolovsky2014-10-31
| | | | | | | It should be fair to say that almost in all cases where some API call expects string, it should be also possible to pass byte string. For example, it should be open/delete/rename file with name as bytestring. Note that similar change was done quite a long ago to mp_obj_str_get_data().
* py: Use MP_OBJ_NULL instead of NULL in a few places.Damien George2014-10-23
|
* py: Make mp_const_empty_bytes globally available.Damien George2014-10-21
|
* py: Change [u]int to mp_[u]int_t in qstr.[ch], and some other places.Damien George2014-10-03
| | | | This should pretty much resolve issue #50.
* py: Simplify JSON str printing (while still conforming to JSON spec).Damien George2014-09-25
| | | | | The JSON specs are relatively flexible and allow us to use one function to print strings, be they ascii, bytes or utf-8 encoded.
* py: Add native json printing using existing print framework.Damien George2014-09-17
| | | | | Also add start of ujson module with dumps implemented. Enabled in unix and stmhal ports. Test passes on both.
* py: Change uint to mp_uint_t in runtime.h, stackctrl.h, binary.h.Damien George2014-08-30
| | | | Part of code cleanup, working towards resolving issue #50.
* py: Remove use of int type in obj.h.Damien George2014-08-30
| | | | Part of code cleanup, working towards resolving issue #50.
* py: Change all uint to mp_uint_t in obj.h.Damien George2014-08-30
| | | | Part of code cleanup, working towards resolving issue #50.
* py: Make tuple and list use mp_int_t/mp_uint_t.Damien George2014-08-30
| | | | Part of code cleanup, to resolve issue #50.
* Change some parts of the core API to use mp_uint_t instead of uint/int.Damien George2014-08-30
| | | | Addressing issue #50, still some way to go yet.
* py: Use memmove instead of memcpy when appropriate.Damien George2014-08-29
| | | | | Found this bug by running unix/ tests with DEBUG=1 enabled when compiling.
* py: Improve efficiency of MP_OBJ_IS_STR_OR_BYTES.Damien George2014-08-27
| | | | | Saves ROM (16 on stmhal, 240 on 64-bit unix) and should be quicker since there is 1 less branch.
* Make int(b'123') work properly.Dave Hylands2014-08-26
|
* py: Fix mult by negative number of tuple, list, str, bytes.Damien George2014-08-13
| | | | | | | 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.
* py, objstr: Optimise bytes subscr when unicode is enabled.Damien George2014-08-11
| | | | Saves code bytes and makes it faster, so why not?
* objstr: Make sure that bytes are indexed as bytes, not as unicode.Paul Sokolovsky2014-08-11
| | | | Fixes #795.
* objstr: split(): check arg type consistency (str vs bytes).Paul Sokolovsky2014-08-10
| | | | Similar to other methods and following CPython3 strictness.
* py: Make MP_OBJ_NEW_SMALL_INT cast arg to mp_int_t itself.Damien George2014-07-31
| | | | Addresses issue #724.
* py: Add mp_obj_str_builder_end_with_len.Damien George2014-07-31
| | | | | This allows to create str's with a smaller length than initially asked for.
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* py: Make unichar_charlen() accept/return machine_uint_t.Paul Sokolovsky2014-06-28
|
* py: Small comments, name changes, use of machine_int_t.Damien George2014-06-28
|
* objstrunicode: Refactor str_index_to_ptr() following objstr.Paul Sokolovsky2014-06-27
|
* objstr: 64-bit issues.Paul Sokolovsky2014-06-27
|
* objstr: find(), rfind(), index(): Make return value be unicode-aware.Paul Sokolovsky2014-06-27
|
* objstrunicode: Re-add buffer protocol back for now, required for io.StringIO.Paul Sokolovsky2014-06-27
|
* py: Make MICROPY_PY_BUILTINS_STR_UNICODE=1 buildable.Paul Sokolovsky2014-06-27
|
* py: Prune unneeded code from objstrunicode, reuse code in objstr.Paul Sokolovsky2014-06-27
|
* objstr: Refactor to work with char pointers instead of indexes.Paul Sokolovsky2014-06-14
| | | | In preparation for unicode support.
* objstr: Be 8-bit clean even for repr().Paul Sokolovsky2014-06-14
| | | | | | | | | 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).
* py: Make sure getattr() works with non-interned strings (by interning them).Paul Sokolovsky2014-06-08
|
* Fix str.modulo when precision is specified.Dave Hylands2014-06-05
|
* py: Raise TypeError when trying to format non-int with %x,%o,%X.Damien George2014-06-05
| | | | | This behaviour follows Python 3.5 standard (in 3.4 it's a DeprecationWarning which we'd rather make a TypeError).
* py: Small changes to objstr.c, including a bug fix.Damien George2014-06-05
| | | | | | | | | | | | | | 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.
* objstr: Implement "%(key)s" % {} formatting for strings and dicts.Paul Sokolovsky2014-06-05
| | | | | Also, make sure that args to "*" format specifiers are bounds-checked properly and don't lead for segfaults in case of mismatch.
* Replace assert(0) with a self-documenting TODO stringChris Angelico2014-06-05
|
* Simplify detection of quote characters in mp_str_print_quoted.Chris Angelico2014-06-04
| | | | | Once a double quote has been found, the subsequent discovery of a single quote won't change behaviour at all, so don't bother looking for one.
* py, str: Replace enum with actual function pointer.Damien George2014-06-01
| | | | | | This way, it's slightly more efficient, uses less ROM (60 bytes less for stmhal), and doesn't require to raise exception if bad operation given.
* Rename bultins config variables to MICROPY_PY_BUILTINS_*.Damien George2014-06-01
| | | | | | | | | | This renames: MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT See issue #35 for discussion.
* objstr: str_uni_istype(): Spurious whitespace on empty lines.Paul Sokolovsky2014-05-31
|