summaryrefslogtreecommitdiff
path: root/py/mpconfig.h
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2018-02-06 00:06:42 +0200
committerDamien George <damien.p.george@gmail.com>2018-02-21 22:39:25 +1100
commit970eedce8f37af46cb2b67fa0e91d76c82057541 (patch)
treed9d0c8511113a8f536bdc230249417568729c1e5 /py/mpconfig.h
parentcced43feb8ffee0791f82c0358265329347f88c7 (diff)
py/objdeque: Implement ucollections.deque type with fixed size.
So far, implements just append() and popleft() methods, required for a normal queue. Constructor doesn't accept an arbitarry sequence to initialize from (am empty deque is always created), so an empty tuple must be passed as such. Only fixed-size deques are supported, so 2nd argument (size) is required. There's also an extension to CPython - if True is passed as 3rd argument, append(), instead of silently overwriting the oldest item on queue overflow, will throw IndexError. This behavior is desired in many cases, where queues should store information reliably, instead of silently losing some items.
Diffstat (limited to 'py/mpconfig.h')
-rw-r--r--py/mpconfig.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h
index d38536f97..532b54ab0 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -936,6 +936,11 @@ typedef double mp_float_t;
#define MICROPY_PY_COLLECTIONS (1)
#endif
+// Whether to provide "ucollections.deque" type
+#ifndef MICROPY_PY_COLLECTIONS_DEQUE
+#define MICROPY_PY_COLLECTIONS_DEQUE (0)
+#endif
+
// Whether to provide "collections.OrderedDict" type
#ifndef MICROPY_PY_COLLECTIONS_ORDEREDDICT
#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0)