Serhiy Storchaka
884eba3c76
bpo-26579: Add object.__getstate__(). (GH-2821)
...
Copying and pickling instances of subclasses of builtin types
bytearray, set, frozenset, collections.OrderedDict, collections.deque,
weakref.WeakSet, and datetime.tzinfo now copies and pickles instance attributes
implemented as slots.
2022-04-06 20:00:14 +03:00
Serhiy Storchaka
a856364cc9
bpo-45229: Use doctest.DocTestSuite instead of run_doctest (GH-28468)
...
Alo use load_tests() for adding tests.
2021-09-20 11:36:57 +03:00
Serhiy Storchaka
2a8127cafe
bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005)
2021-08-29 14:04:40 +03:00
Dong-hee Na
5a3108044d
bpo-28395: Remove unnecessary semicolons in tests (GH-26868)
2021-06-23 18:01:06 +09:00
Raymond Hettinger
6fdc4d37f3
bpo-40521: Convert deque freelist from global vars to instance vars (GH-25906)
2021-05-04 17:08:31 -07:00
Serhiy Storchaka
f9bab74d5b
bpo-41055: Remove outdated tests for the tp_print slot. (GH-21006)
2020-06-21 11:11:17 +03:00
sweeneyde
c6dedde160
bpo-39590: make deque.__contains__ and deque.count hold strong references (GH-18421)
2020-02-09 00:16:43 -08:00
Raymond Hettinger
b46ad5431d
Minor performance tweak for deque.index() with a start argument (GH-9440)
2018-09-21 01:46:41 -07:00
Oren Milman
24bd50bdcc
closes bpo-31608: Fix a crash in methods of a subclass of _collections.deque with a bad __new__(). (GH-3788)
2018-09-11 11:46:55 -07:00
Victor Stinner
d6debb24e0
bpo-29919: Remove unused imports found by pyflakes ( #137 )
...
Make also minor PEP8 coding style fixes on modified imports.
2017-03-27 16:05:26 +02:00
Martin Panter
8bde911115
Issue #27626 : Merge spelling fixes from 3.5
2016-07-28 01:30:58 +00:00
Martin Panter
eb9957065a
Issue #27626 : Spelling fixes in docs, comments and internal names
...
Based on patch by Ville Skyttä.
2016-07-28 01:11:04 +00:00
Serhiy Storchaka
b6686fe0a0
Fixed test_sizeof for deque.
2016-05-18 13:01:19 +03:00
Serhiy Storchaka
e23c90c344
Fixed test_sizeof for deque.
2016-05-18 13:00:56 +03:00
Serhiy Storchaka
ab479c49d3
Issue #26494 : Fixed crash on iterating exhausting iterators.
...
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:41:15 +03:00
Serhiy Storchaka
fbb1c5ee06
Issue #26494 : Fixed crash on iterating exhausting iterators.
...
Affected classes are generic sequence iterators, iterators of str, bytes,
bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding
views and os.scandir() iterator.
2016-03-30 20:40:02 +03:00
Serhiy Storchaka
de128e19e2
Issue #26015 : Added new tests for pickling iterators of mutable sequences.
2016-03-06 14:12:04 +02:00
Serhiy Storchaka
aabafe7bc2
Issue #26015 : Added new tests for pickling iterators of mutable sequences.
2016-03-06 14:10:24 +02:00
Serhiy Storchaka
a0d416f0d1
Issue #26482 : Allowed pickling recursive dequeues.
2016-03-06 08:55:21 +02:00
Raymond Hettinger
a63897164e
merge
2016-02-01 21:21:19 -08:00
Raymond Hettinger
b00da57561
Issue #26194 : Inserting into a full deque to raise an IndexError
2016-02-01 21:19:22 -08:00
Raymond Hettinger
0ef0423cb2
merge
2016-01-26 21:46:03 -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
Raymond Hettinger
906d82db6d
Fix typo
2016-01-25 23:00:21 -08:00
Raymond Hettinger
aed8830af3
Add a fast path (no iterator creation) for a common case for repeating deques of size 1
2015-09-19 09:05:42 -07:00
Brett Cannon
df6b544ff6
Issue #24913 : Fix overrun error in deque.index().
...
Reported by John Leitch and Bryce Darling, patch by Raymond Hettinger.
2015-09-03 10:15:03 -07:00
Raymond Hettinger
87674ec7d5
Issue #24913 : Fix overrun error in deque.index().
2015-08-26 08:08:38 -07:00
Raymond Hettinger
067bbba7a4
Check deques against common sequence tests (except for slicing).
2015-04-01 08:11:09 -07:00
Raymond Hettinger
41290a68ba
Issue 23793: Add deque support for __add__(), __mul__(), and __imul__().
2015-03-31 08:12:23 -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
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
Serhiy Storchaka
65ee4674e2
Issue #22777 : Test pickling with all protocols.
2014-12-15 14:06:02 +02:00
Serhiy Storchaka
bad1257c96
Issue #22777 : Test pickling with all protocols.
2014-12-15 14:03:42 +02:00
Raymond Hettinger
badf5d839d
Issue 19898: Add test for dequereviter_new.
...
(Patch contributed by Claudiu Popa.)
2014-06-14 20:41:22 -07:00
Raymond Hettinger
77578204d6
Restore the data block size to 62.
...
The former block size traded away good fit within cache lines in
order to gain faster division in deque_item(). However, compilers
are getting smarter and can now replace the slow division operation
with a fast integer multiply and right shift. Accordingly, it makes
sense to go back to a size that lets blocks neatly fill entire
cache-lines.
GCC-4.8 and CLANG 4.0 both compute "x // 62" with something
roughly equivalent to "x * 9520900167075897609 >> 69".
2013-07-28 02:39:49 -07:00
Raymond Hettinger
d9c116ca40
Add a spacing saving heuristic to deque's extend methods
2013-07-09 00:13:21 -07:00
Raymond Hettinger
de68e0cf0e
Speed-up deque indexing by changing the deque block length to a power of two.
...
The division and modulo calculation in deque_item() can be compiled
to fast bitwise operations when the BLOCKLEN is a power of two.
Timing before:
~/cpython $ py -m timeit -r7 -s 'from collections import deque' -s 'd=deque(range(10))' 'd[5]'
10000000 loops, best of 7: 0.0627 usec per loop
Timing after:
~/cpython $ py -m timeit -r7 -s 'from collections import deque' -s 'd=deque(range(10))' 'd[5]'
10000000 loops, best of 7: 0.0581 usec per loop
2013-07-05 18:05:29 -10:00
Jesus Cea
1659b75189
MERGE: Closes #15469 : Correct __sizeof__ support for deque
2012-08-03 14:52:12 +02:00
Jesus Cea
16e2fca47e
Closes #15469 : Correct __sizeof__ support for deque
2012-08-03 14:49:42 +02:00
Kristján Valur Jónsson
31668b8f7a
Issue #14288 : Serialization support for builtin iterators.
2012-04-03 10:49:41 +00:00
Raymond Hettinger
512d2cc643
Issue #11004 : Repair edge case in deque.count().
...
(Reviewed by Georg Brandl.)
Also made similar changes to deque.reverse() though this wasn't
strictly necessary (the edge case cannot occur with two pointers
moving to meet in the middle). Making the change in reverse()
was more a matter of future-proofing.
2011-01-25 21:32:39 +00:00
Ezio Melotti
b3aedd4862
#9424 : Replace deprecated assert* methods in the Python test suite.
2010-11-20 19:04:17 +00:00
Raymond Hettinger
44459debc6
Add count() method to collections.deque().
2010-04-03 23:20:46 +00:00
Georg Brandl
1b37e8728c
Merged revisions 78093 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78093 | georg.brandl | 2010-02-07 18:03:15 +0100 (So, 07 Feb 2010) | 1 line
Remove unused imports in test modules.
........
2010-03-14 10:45:50 +00:00
Benjamin Peterson
577473fe68
use assert[Not]In where appropriate
...
A patch from Dave Malcolm.
2010-01-19 00:09:57 +00:00
Raymond Hettinger
3f9afd816d
Fix variants of deque.extend: d.extend(d) d+=d d.extendleft(d)
2009-12-10 03:03:02 +00:00
Raymond Hettinger
e5fdedbeda
Add a reverse() method to collections.deque().
2009-12-10 00:47:21 +00:00
Benjamin Peterson
c9c0f201fe
convert old fail* assertions to assert*
2009-06-30 23:06:06 +00:00
Raymond Hettinger
5bb0f0e072
For collections.deque() objects, expose the maxlen parameter as a read-only attribute.
2009-03-10 12:56:32 +00:00