diff options
| author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-02-24 16:48:01 +0100 |
|---|---|---|
| committer | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-02-24 16:48:01 +0100 |
| commit | 7dbe4e98a7f7910809fa9f0aa68d01993e1bb8b8 (patch) | |
| tree | 61b76ad1080d4eb9c0db4ae90dca951a7bcca593 | |
| parent | 75d6abe3bb57cf75915a056e5e98e4b79efec2ad (diff) | |
Make slice make_new match mp_make_new_fun_t exactly, check the input type and enable it for qemu tests.
| -rw-r--r-- | py/objslice.c | 7 | ||||
| -rw-r--r-- | qemu-arm/mpconfigport.h | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/py/objslice.c b/py/objslice.c index 6c9592628..65a991884 100644 --- a/py/objslice.c +++ b/py/objslice.c @@ -129,7 +129,7 @@ STATIC void slice_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { } STATIC mp_obj_t slice_make_new(const mp_obj_type_t *type, - mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args); + size_t n_args, size_t n_kw, const mp_obj_t *args); #endif const mp_obj_type_t mp_type_slice = { @@ -153,7 +153,10 @@ mp_obj_t mp_obj_new_slice(mp_obj_t ostart, mp_obj_t ostop, mp_obj_t ostep) { #if MICROPY_PY_BUILTINS_SLICE_ATTRS STATIC mp_obj_t slice_make_new(const mp_obj_type_t *type, - mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) { + size_t n_args, size_t n_kw, const mp_obj_t *args) { + if (type != &mp_type_slice) { + mp_raise_NotImplementedError("Cannot subclass slice"); + } // check number of arguments mp_arg_check_num(n_args, n_kw, 1, 3, false); diff --git a/qemu-arm/mpconfigport.h b/qemu-arm/mpconfigport.h index 8ee9cdc4b..5665dc392 100644 --- a/qemu-arm/mpconfigport.h +++ b/qemu-arm/mpconfigport.h @@ -20,6 +20,7 @@ #define MICROPY_PY_ARRAY_SLICE_ASSIGN (1) #define MICROPY_PY_BUILTINS_FROZENSET (1) #define MICROPY_PY_BUILTINS_MEMORYVIEW (1) +#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1) #define MICROPY_PY_IO (1) #define MICROPY_PY_SYS_EXIT (1) #define MICROPY_PY_SYS_MAXSIZE (1) |
