summaryrefslogtreecommitdiff
path: root/py/objslice.c
diff options
context:
space:
mode:
authorJohn R. Lenton <jlenton@gmail.com>2014-01-05 22:29:03 +0000
committerJohn R. Lenton <jlenton@gmail.com>2014-01-05 22:29:03 +0000
commitba3f87c94776538fece5e87ff1d7de547930397a (patch)
tree3112b328cff278168a1ef48fc37a65778ea9324a /py/objslice.c
parent6e1e98f8648d327098a03ce8d175c9854dd06cc8 (diff)
parent12e2656472bf53e467c066eda6f3e177a97210ca (diff)
Merge remote-tracking branch 'upstream/master' into list_reverse
Diffstat (limited to 'py/objslice.c')
-rw-r--r--py/objslice.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/py/objslice.c b/py/objslice.c
index 03607e4c3..a624be963 100644
--- a/py/objslice.c
+++ b/py/objslice.c
@@ -9,6 +9,36 @@
#include "obj.h"
#include "runtime0.h"
+/******************************************************************************/
+/* ellipsis object, a singleton */
+
+typedef struct _mp_obj_ellipsis_t {
+ mp_obj_base_t base;
+} mp_obj_ellipsis_t;
+
+void ellipsis_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in) {
+ print(env, "Ellipsis");
+}
+
+const mp_obj_type_t ellipsis_type = {
+ { &mp_const_type },
+ "ellipsis",
+ ellipsis_print, // print
+ NULL, // make_new
+ NULL, // call_n
+ NULL, // unary_op
+ NULL, // binary_op
+ NULL, // getiter
+ NULL, // iternext
+ {{NULL, NULL},}, // method list
+};
+
+static const mp_obj_ellipsis_t ellipsis_obj = {{&ellipsis_type}};
+const mp_obj_t mp_const_ellipsis = (mp_obj_t)&ellipsis_obj;
+
+/******************************************************************************/
+/* slice object */
+
#if MICROPY_ENABLE_SLICE
// TODO: This implements only variant of slice with 2 integer args only.
@@ -29,6 +59,7 @@ const mp_obj_type_t slice_type = {
"slice",
slice_print,
NULL, // call_n
+ NULL, // make_new
NULL, // unary_op
NULL, // binary_op
NULL, // getiter