diff options
| author | Glenn Ruben Bakke <glennbakke@gmail.com> | 2017-06-03 23:23:08 +0200 |
|---|---|---|
| committer | Glenn Ruben Bakke <glennbakke@gmail.com> | 2017-06-03 23:23:08 +0200 |
| commit | 227eeb1408cd442e896c33fd82d1d709ee9c95cd (patch) | |
| tree | 7dfd4bf6894d59c299107960c47bace77cf166df /py/objstr.c | |
| parent | d83c4fa130692ed9dbdfbe1bb8903da5721e7734 (diff) | |
| parent | a0dbbbebb8c0286e00ae06751b0173cbca4ec801 (diff) | |
Merge remote-tracking branch 'upstream/master' into nrf5_no_sdk
Diffstat (limited to 'py/objstr.c')
| -rw-r--r-- | py/objstr.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/py/objstr.c b/py/objstr.c index 70de0a693..1d2a28045 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -602,6 +602,11 @@ STATIC mp_obj_t str_rsplit(size_t n_args, const mp_obj_t *args) { GET_STR_DATA_LEN(args[0], s, len); mp_int_t splits = mp_obj_get_int(args[2]); + if (splits < 0) { + // Negative limit means no limit, so delegate to split(). + return mp_obj_str_split(n_args, args); + } + mp_int_t org_splits = splits; // Preallocate list to the max expected # of elements, as we // will fill it from the end. @@ -798,7 +803,7 @@ STATIC mp_obj_t str_uni_strip(int type, size_t n_args, const mp_obj_t *args) { } assert(last_good_char_pos >= first_good_char_pos); - //+1 to accomodate the last character + //+1 to accommodate the last character size_t stripped_len = last_good_char_pos - first_good_char_pos + 1; if (stripped_len == orig_str_len) { // If nothing was stripped, don't bother to dup original string @@ -1811,7 +1816,7 @@ STATIC mp_obj_t str_islower(mp_obj_t self_in) { } #if MICROPY_CPYTHON_COMPAT -// These methods are superfluous in the presense of str() and bytes() +// These methods are superfluous in the presence of str() and bytes() // constructors. // TODO: should accept kwargs too STATIC mp_obj_t bytes_decode(size_t n_args, const mp_obj_t *args) { |
