1 parent ab954ed commit 9f85c4fCopy full SHA for 9f85c4f
1 file changed
py/objstr.c
@@ -602,6 +602,11 @@ STATIC mp_obj_t str_rsplit(size_t n_args, const mp_obj_t *args) {
602
GET_STR_DATA_LEN(args[0], s, len);
603
604
mp_int_t splits = mp_obj_get_int(args[2]);
605
+ if (splits < 0) {
606
+ // Negative limit means no limit, so delegate to split().
607
+ return mp_obj_str_split(n_args, args);
608
+ }
609
+
610
mp_int_t org_splits = splits;
611
// Preallocate list to the max expected # of elements, as we
612
// will fill it from the end.
0 commit comments