Commit graph

127 commits

Author SHA1 Message Date
Raymond Hettinger b00da57561 Issue #26194: Inserting into a full deque to raise an IndexError 2016-02-01 21:19:22 -08:00
Raymond Hettinger 3743432302 Issue #26194: Fix undefined behavior for deque.insert() when len(d) == maxlen 2016-01-26 21:44:16 -08:00
Benjamin Peterson 4e3dd51396 merge 3.4 2016-01-01 11:56:16 -06:00
Benjamin Peterson 630329e4ea merge 3.3 2016-01-01 11:55:47 -06:00
Benjamin Peterson 0e617e22f0 remove some copyright notices supserseded by the toplevel ones 2016-01-01 11:53:47 -06:00
Serhiy Storchaka 5c4064e8bd Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size.
This allows sys.getsize() to work correctly with their subclasses with
__slots__ defined.
2015-12-19 20:05:25 +02:00
Martin Panter d2ad5718ad Issue #25523: Further a-to-an corrections new in 3.5 2015-11-02 04:20:33 +00:00
Raymond Hettinger 848f2b595d Backport early-out 91259f061cfb to reduce the cost of bb1a2944bcb6 2015-10-06 23:06:17 -04:00
Raymond Hettinger bf49fee125 Issue #25135: Avoid possible reentrancy issues in deque_clear. 2015-09-26 00:14:59 -07:00
Raymond Hettinger 2b2b75374e Prevent reentrant badness by deferring the decrefs as long as possible. 2015-09-05 17:05:52 -07:00
Raymond Hettinger 87674ec7d5 Issue #24913: Fix overrun error in deque.index(). 2015-08-26 08:08:38 -07:00
Raymond Hettinger 239aba7874 Issue #19663: Improve error message for defaultdict. 2015-07-20 03:09:22 -04:00
Raymond Hettinger 043e800860 merge 2015-07-20 03:10:48 -04:00
Eric Snow 96c6af9b20 Issue #16991: Add a C implementation of collections.OrderedDict. 2015-05-29 22:21:39 -06:00
Raymond Hettinger c6249a6268 Defer deleted item decref until after the deque is restored to a consistent state. 2015-05-02 10:44:17 -07:00
Benjamin Peterson 1a6292194b fix refleak in deque_concat 2015-04-04 10:52:36 -04:00
Raymond Hettinger 41290a68ba Issue 23793: Add deque support for __add__(), __mul__(), and __imul__(). 2015-03-31 08:12:23 -07:00
Raymond Hettinger fef9c1b368 Fix typo 2015-03-24 21:12:57 -07:00
Raymond Hettinger 8dbbae2e52 Minor code and comment cleanups. 2015-03-24 21:01:50 -07:00
Raymond Hettinger 551350a79f Improve and fix-up comments. 2015-03-24 00:19:53 -07:00
Raymond Hettinger 0f1451c8c0 Issue 23744: Minor speed-up for deque.__bool__(). 2015-03-23 23:23:55 -07:00
Raymond Hettinger 6921c13bbb Minor nit. Make the rotate() success/fail tests consistent. 2015-03-21 02:03:40 -07:00
Raymond Hettinger ac13ad6a32 For safety, wait to decref deleted values until the deque state has been restored. 2015-03-21 01:53:16 -07:00
Raymond Hettinger 0f6f94778a Fix minor formatting nits and remove unnecessary comment. 2015-03-21 01:42:10 -07:00
Raymond Hettinger 32ea16577d Issue 23704: Add index(), copy(), and insert() to deques. Register deques as a MutableSequence. 2015-03-21 01:37:37 -07:00
Raymond Hettinger 39dadf7abf Issue 23705: Improve the performance of __contains__ checks for deques. 2015-03-20 16:38:56 -07:00
Raymond Hettinger 87e691240b Minor neatening-up. Make assignments in same order a struct fields. Line-up comments. 2015-03-02 23:32:02 -08:00
Raymond Hettinger f9d9c79aa8 Switch the state variable to unsigned for defined wrap-around behavior. 2015-03-02 22:47:46 -08:00
Raymond Hettinger 30c9074b96 Minor beautification. Move struct definitions to the top. Fix-up a comment. 2015-03-02 22:31:35 -08:00
Raymond Hettinger f30f5b9ba6 Minor code beautification. Replace macro with in-lineable functions. 2015-03-02 22:23:37 -08:00
Raymond Hettinger 3c186ba441 Beautify and better document the use of the size_t cast for bounds checking. 2015-03-02 21:45:02 -08:00
Raymond Hettinger 7f9ea7543e Issue #23553: Use an unsigned cast to tighten-up the bounds checking logic. 2015-03-01 00:38:00 -08:00
Raymond Hettinger c20830804d Need a (size_t) cast instead of (unsigned) to be big enough for a Py_ssize_t. 2015-02-28 23:29:16 -08:00
Raymond Hettinger a473b9da15 Use unsigned division and modulo for item assignment as well. 2015-02-28 17:49:47 -08:00
Raymond Hettinger 63d1ff2a0b Convert one more division to unsigned arithmetic to speed-up deque_item(). 2015-02-28 07:41:30 -08:00
Raymond Hettinger 7e8c7956a7 Line missed in last checkin 2015-02-27 16:59:29 -08:00
Raymond Hettinger da2850f932 Since the index is always non-negative, use faster unsigned division and modulo. 2015-02-27 12:42:54 -08:00
Raymond Hettinger daf57f25e5 Bump the blocksize up from 62 to 64 to speed up the modulo calculation.
Remove the old comment suggesting that it was desireable to have
blocksize+2 as a multiple of the cache line length.  That would
have made sense only if the block structure start point was always
aligned to a cache line boundary.  However, the memory allocations
are 16 byte aligned, so we don't really have control over whether
the struct spills across cache line boundaries.
2015-02-26 23:21:29 -08:00
Raymond Hettinger eb6b554fbc Update copyright. 2015-02-10 22:37:22 -06:00
Raymond Hettinger 0e259f18f7 Optimization guides suggest copying memory in an ascending direction when possible. 2015-02-01 22:53:41 -08:00
Raymond Hettinger 507d997714 Add comment and make minor code clean-up to improve clarity. 2014-05-18 21:32:40 +01:00
Raymond Hettinger 4b0b1accb5 Issue #21101: Eliminate double hashing in the C code for collections.Counter(). 2014-05-03 16:41:19 -07:00
Raymond Hettinger 5402315626 Add implementation notes 2014-04-23 00:58:48 -07:00
Benjamin Peterson e19d9d1467 merge 3.3 (#20250) 2014-01-13 23:56:30 -05:00
Benjamin Peterson 9cb33b7d03 correct defaultdict signature in docstring (closes #20250)
Patch from Andrew Barnert.
2014-01-13 23:56:05 -05:00
Victor Stinner e7f516cbb8 Issue #19512: _count_elements() of _collections reuses PyId_get identifier
instead of literal "get" string
2013-11-06 23:52:55 +01:00
Raymond Hettinger 07573d7b24 merge 2013-10-04 16:52:39 -07:00
Raymond Hettinger cb1d96f782 Issue #18594: Make the C code more closely match the pure python code. 2013-10-04 16:51:02 -07:00
Raymond Hettinger 75f65e368e merge 2013-10-01 21:38:37 -07:00
Raymond Hettinger 224c87d60c Issue #18594: Fix the fallback path in collections.Counter(). 2013-10-01 21:36:09 -07:00