Commit Graph

208 Commits

Author SHA1 Message Date
Serhiy Storchaka 6ca9d3e017
gh-109786: Fix leaks and crash when re-enter itertools.pairwise.__next__() (GH-109788) 2023-12-04 11:47:55 +00:00
Serhiy Storchaka f3ba0a74cd
gh-108416: Mark slow test methods with @requires_resource('cpu') (GH-108421)
Only mark tests which spend significant system or user time,
by itself or in subprocesses.
2023-09-02 07:45:34 +03:00
Raymond Hettinger 402ee5a68b
GH-101588: Deprecate pickle/copy/deepcopy support in itertools (GH-104965) 2023-05-26 15:32:53 -05:00
wim glenn 4bb1dd3c5c
gh-102876: remove superfluous parens from itertools.batched recipe (GH-102877)
remove superfluous parens from itertools.batched recipe
2023-03-21 12:06:18 -05:00
Erlend E. Aasland 2b3e02a705
gh-101277: Isolate itertools, add group and _grouper types to module state (#101302)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-02-01 12:41:30 +01:00
Raymond Hettinger 35cc0ea736
GH-98363: Have batched() return tuples (GH-100118) 2022-12-08 15:08:16 -06:00
Serhiy Storchaka 922a6cf6c2
gh-60203: Revert changes in cycle.__setstate__ (#99982)
In case if only True/False be supported as boolean arguments in future,
we should continue to support 1/0 here.
2022-12-05 17:27:40 +01:00
Serhiy Storchaka a87c46eab3
bpo-15999: Accept arbitrary values for boolean parameters. (#15609)
builtins and extension module functions and methods that expect boolean values for parameters now accept any Python object rather than just a bool or int type. This is more consistent with how native Python code itself behaves.
2022-12-03 11:52:21 -08:00
Raymond Hettinger a5ff80c8bc
GH-98363: Fix exception handling in batched() (GH-98523) 2022-10-21 12:31:52 -05:00
Raymond Hettinger de3ece769a
GH-98363: Add itertools.batched() (GH-98364) 2022-10-17 18:53:45 -05:00
Jeong YunWon 274769c61c
gh-93814: Add infinite test for itertools.chain.from_iterable (GH-93815)
fix #93814

Automerge-Triggered-By: GH:rhettinger
2022-06-14 13:45:50 -07:00
Christian Heimes 2b16a08bc7
bpo-40280: Detect missing threading on WASM platforms (GH-32352)
Co-authored-by: Brett Cannon <brett@python.org>
2022-04-07 09:22:47 +02:00
Raymond Hettinger ee60550e9b
Move doctests to the main docs. Eliminate duplication. Improve coverage. (GH-30869) 2022-01-25 06:56:53 -06:00
Raymond Hettinger 270a09184d
Improve grouper() recipe to demonstrate all forms of zip() (GH-30837) 2022-01-23 14:31:10 -06: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
Raymond Hettinger fcbf9b176b
Docs: Clarify the before_and_after() example (GH-28458) 2021-09-19 19:52:27 -05:00
Serhiy Storchaka 92bf8691fb
bpo-43413: Fix handling keyword arguments in subclasses of some buitin classes (GH-26456)
* Constructors of subclasses of some buitin classes (e.g. tuple, list,
  frozenset) no longer accept arbitrary keyword arguments.
* Subclass of set can now define a __new__() method with additional
  keyword parameters without overriding also __init__().
2021-09-12 13:27:50 +03:00
Raymond Hettinger 750368cbcd
Add more itertool recipes (GH-28165) 2021-09-07 12:29:00 -05:00
Raymond Hettinger 91be41ad93
bpo-44571: Add itertool recipe for a variant of takewhile() (GH-28167) 2021-09-05 00:09:26 -05: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
Brandt Bucher 226a012d1c
bpo-42536: GC track recycled tuples (GH-23623)
Several built-in and standard library types now ensure that their internal result tuples are always tracked by the garbage collector:

- collections.OrderedDict.items
- dict.items
- enumerate
- functools.reduce
- itertools.combinations
- itertools.combinations_with_replacement
- itertools.permutations
- itertools.product
- itertools.zip_longest
- zip

Previously, they could have become untracked by a prior garbage collection.
2020-12-04 19:45:57 -08:00
Raymond Hettinger cc061d0e6f
bpo-38200: Add itertools.pairwise() (GH-23549) 2020-11-30 20:42:54 -08:00
Raymond Hettinger fc40b3020c
bpo-42450: Minor updates to the itertools recipes (GH-23555) 2020-11-29 10:47:22 -08:00
Serhiy Storchaka 526a01467b
bpo-34410: Fix a crash in the tee iterator when re-enter it. (GH-15625)
RuntimeError is now raised in this case.
2019-09-09 11:47:14 +03:00
Sergey Fedoseev 6a650aaf77 bpo-37976: Prevent shadowing of TypeError in zip() (GH-15592) 2019-08-29 21:25:48 -07:00
Neil Schemenauer 52a48e62c6
bpo-37707: Exclude expensive unit tests from PGO task (GH-15009)
Mark some individual tests to skip when --pgo is used.  The tests
marked increase the PGO task time significantly and likely don't
help improve optimization of the final executable.
2019-07-30 11:08:18 -07:00
Lisa Roach 9718b59ee5
bpo-34659: Adds initial kwarg to itertools.accumulate() (GH-9345) 2018-09-23 17:34:59 -07:00
Raymond Hettinger 9265dd72e5
Add a prepend() recipe to teach a chain() idiom (GH-6415) 2018-04-08 08:44:20 -07:00
Cheryl Sabella da1734c58d bpo-27212: Modify islice recipe to consume initial values preceding start (GH-6195) 2018-03-26 18:29:33 -07:00
Raymond Hettinger d37258dd2e
Add itertools recipe for directly finding the n-th combination (#5161) 2018-01-13 10:35:40 -08:00
Serhiy Storchaka c740e4fe8a bpo-30347: Stop crashes when concurrently iterate over itertools.groupby() iterators. (#1557) 2017-09-26 21:47:56 +03:00
Serhiy Storchaka c247caf33f bpo-30346: An iterator produced by the itertools.groupby() iterator (#1569)
now becames exhausted after advancing the groupby iterator.
2017-09-24 13:36:11 +03:00
Will Roberts 0ecdc52514 bpo-30537: use PyNumber in itertools.islice instead of PyLong (#1918)
* bpo-30537: use PyNumber in itertools instead of PyLong

* bpo-30537: revert changes except to islice_new

* bpo-30537: test itertools.islice and add entry to Misc/NEWS
2017-06-07 23:03:04 -07:00
Serhiy Storchaka 5eb788bf7f bpo-30534: Fixed error messages when pass keyword arguments (#1901)
to functions implemented in C that don't support this.

Also unified error messages for functions that don't take positional or keyword
arguments.
2017-06-06 18:45:22 +03:00
T. Wouters 5466d4af5f bpo-29942: Fix the use of recursion in itertools.chain.from_iterable. (#889)
Fix the use of recursion in itertools.chain.from_iterable. Using recursion
is unnecessary, and can easily cause stack overflows, especially when
building in low optimization modes or with Py_DEBUG enabled.
2017-03-30 09:58:35 -07:00
Serhiy Storchaka 8f0f205649 Issue #28322: Fixed possible crashes when unpickle itertools objects from
incorrect pickle data.  Based on patch by John Leitch.
2016-10-02 09:13:14 +03:00
Serhiy Storchaka 85c3f268f4 Issue #28322: Fixed possible crashes when unpickle itertools objects from
incorrect pickle data.  Based on patch by John Leitch.
2016-10-02 08:34:53 +03:00
Serhiy Storchaka 8f9cafad3d Issue #28019: itertools.count() no longer rounds non-integer step in range
between 1.0 and 2.0 to 1.
2016-09-10 09:53:51 +03:00
Serhiy Storchaka 8ddcf3abf7 Issue #28019: itertools.count() no longer rounds non-integer step in range
between 1.0 and 2.0 to 1.
2016-09-10 09:49:24 +03:00
Martin Panter f157982b2c Issue #27076: More doc and comment spelling fixes for 3.6, by Ville Skyttä 2016-05-26 06:03:33 +00:00
Serhiy Storchaka c7f44aa99a Issue #23277: Remove more unused sys and os imports. 2016-04-24 13:25:01 +03:00
Raymond Hettinger 20b3e72b8d Merge 2016-03-06 18:12:08 -08:00
Raymond Hettinger e525ee3b48 Document another recipe for itertools: all_equal(). Inspired by David Beazley. 2016-03-06 18:11:38 -08:00
Serhiy Storchaka 5608411a96 Issue #25718: Fixed pickling and copying the accumulate() iterator with total is None. 2016-03-06 14:02:26 +02:00
Serhiy Storchaka d55162517d Issue #25718: Fixed pickling and copying the accumulate() iterator with total is None. 2016-03-06 14:00:45 +02:00
Kristján Valur Jónsson a8a930f863 Issue #25021: Merge 3.5 to default 2015-09-12 16:36:15 +00:00
Kristján Valur Jónsson d7f65e5763 Issue #25021: Merge 3.4 to 3.5 2015-09-12 16:34:33 +00:00
Kristján Valur Jónsson 95c3e6cb22 Issue #25021: Merge from 3.3 to 3.4 2015-09-12 15:30:23 +00:00
Kristján Valur Jónsson 102764a1f6 Issue #25021: Correctly make sure that product.__setstate__ does not access
invalid memory.
2015-09-12 15:20:54 +00:00
Raymond Hettinger 1cadf769b3 Improve comment 2015-08-15 14:47:27 -07:00