py/objstr: Make str.rsplit(None,n) raise NotImpl instead of assert(0).
This commit is contained in:
parent
1b693543aa
commit
22602cc37b
@ -578,7 +578,7 @@ STATIC mp_obj_t str_rsplit(mp_uint_t n_args, const mp_obj_t *args) {
|
|||||||
mp_int_t idx = splits;
|
mp_int_t idx = splits;
|
||||||
|
|
||||||
if (sep == mp_const_none) {
|
if (sep == mp_const_none) {
|
||||||
assert(!"TODO: rsplit(None,n) not implemented");
|
mp_not_implemented("rsplit(None,n)");
|
||||||
} else {
|
} else {
|
||||||
mp_uint_t sep_len;
|
mp_uint_t sep_len;
|
||||||
const char *sep_str = mp_obj_str_get_data(sep, &sep_len);
|
const char *sep_str = mp_obj_str_get_data(sep, &sep_len);
|
||||||
|
@ -39,3 +39,9 @@ try:
|
|||||||
print('{a[0]}'.format(a=[1, 2]))
|
print('{a[0]}'.format(a=[1, 2]))
|
||||||
except NotImplementedError:
|
except NotImplementedError:
|
||||||
print('NotImplementedError')
|
print('NotImplementedError')
|
||||||
|
|
||||||
|
# str.rsplit(None, n) not implemented
|
||||||
|
try:
|
||||||
|
'a a a'.rsplit(None, 1)
|
||||||
|
except NotImplementedError:
|
||||||
|
print('NotImplementedError')
|
||||||
|
@ -4,3 +4,4 @@ True
|
|||||||
True
|
True
|
||||||
TypeError, ValueError
|
TypeError, ValueError
|
||||||
NotImplementedError
|
NotImplementedError
|
||||||
|
NotImplementedError
|
||||||
|
Loading…
x
Reference in New Issue
Block a user