Age | Commit message (Collapse) | Author | |
---|---|---|---|
2018-05-11 | py/objdeque: Fix sign extension bug when computing len of deque object. | Damien George | |
For cases where size_t is smaller than mp_int_t (eg nan-boxing builds) the difference between two size_t's is not sign extended into mp_int_t and so the result is never negative. This patch fixes this bug by using ssize_t for the type of the result. | |||
2018-02-21 | py/objdeque: Use m_new0 when allocating items to avoid need to clear. | Damien George | |
Saves a few bytes of code space, and is more efficient because with MICROPY_GC_CONSERVATIVE_CLEAR enabled by default all memory is already cleared when allocated. | |||
2018-02-21 | py/objdeque: Protect against negative maxlen in deque constructor. | Damien George | |
Otherwise passing -1 as maxlen will lead to a zero allocation and subsequent unbound buffer overflow in deque.append() because i_put is allowed to grow without bound. | |||
2018-02-21 | py/objdeque: Allow to compile without warnings by disabling deque_clear. | Damien George | |
2018-02-21 | py/objdeque: Implement ucollections.deque type with fixed size. | Paul Sokolovsky | |
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. |