Serhiy Storchaka
f320be77ff
bpo-32571: Avoid raising unneeded AttributeError and silencing it in C code (GH-5222)
...
Add two new private APIs: _PyObject_LookupAttr() and _PyObject_LookupAttrId()
2018-01-25 17:49:40 +09:00
Serhiy Storchaka
1707e4020f
bpo-31572: Silence only AttributeError when get the __copy__ attribute in itertools.tee(). ( #3724 )
2017-11-11 15:51:42 +02:00
Serhiy Storchaka
c740e4fe8a
bpo-30347: Stop crashes when concurrently iterate over itertools.groupby() iterators. ( #1557 )
2017-09-26 21:47:56 +03:00
Raymond Hettinger
49392c63a2
bpo-27385: Clarify docstring for groupby() ( #3738 )
2017-09-25 01:21:06 -07: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
Serhiy Storchaka
b3a77964ea
bpo-27541: Reprs of subclasses of some classes now contain actual type name. ( #3631 )
...
Affected classes are bytearray, array, deque, defaultdict, count and repeat.
2017-09-21 14:24:13 +03:00
Serhiy Storchaka
4ab46d7949
bpo-31497: Add private helper _PyType_Name(). ( #3630 )
...
This function returns the last component of tp_name after a dot.
Returns tp_name itself if it doesn't contain a dot.
2017-09-17 21:11:04 +03:00
Serhiy Storchaka
6cca5c8459
bpo-30592: Fixed error messages for some builtins. ( #1996 )
...
Error messages when pass keyword arguments to some builtins that
don't support keyword arguments contained double parenthesis: "()()".
The regression was introduced by bpo-30534.
2017-06-08 14:41:19 +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
bf623ae884
bpo-30061: Check if PyObject_Size()/PySequence_Size()/PyMapping_Size() ( #1096 )
...
raised an error.
Replace them with using concrete types API that never fails if appropriate.
2017-04-19 20:03:52 +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
ba85d69a3e
bpo-29878: Add global instances of int for 0 and 1. ( #852 )
2017-03-30 09:09:41 +03:00
Serhiy Storchaka
fff9a31a91
bpo-29865: Use PyXXX_GET_SIZE macros rather than Py_SIZE for concrete types. ( #748 )
2017-03-21 08:53:25 +02:00
Serhiy Storchaka
5ab81d787f
Issue #28959 : Added private macro PyDict_GET_SIZE for retrieving the size of dict.
2016-12-16 16:18:57 +02:00
Victor Stinner
de4ae3d486
Backed out changeset b9c9691c72c5
...
Issue #28858 : The change b9c9691c72c5 introduced a regression. It seems like
_PyObject_CallArg1() uses more stack memory than
PyObject_CallFunctionObjArgs().
2016-12-04 22:59:09 +01:00
Victor Stinner
27580c1fb5
Replace PyObject_CallFunctionObjArgs() with fastcall
...
* PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func)
* PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg)
PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires
extra work to "parse" C arguments to build a C array of PyObject*.
_PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate
memory on the C stack.
This change is part of the fastcall project. The change on listsort() is
related to the issue #23507 .
2016-12-01 14:43:22 +01: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
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
b6a9c9761c
Issue #26778 : Fixed "a/an/and" typos in code comment, documentation and error
...
messages.
2016-04-17 09:39:28 +03:00
Serhiy Storchaka
6a7b3a77b4
Issue #26778 : Fixed "a/an/and" typos in code comment and documentation.
2016-04-17 08:32:47 +03:00
Serhiy Storchaka
f01e408c16
Issue #26200 : Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
...
in places where Py_DECREF was used.
2016-04-10 18:12:01 +03:00
Serhiy Storchaka
57a01d3a0e
Issue #26200 : Added Py_SETREF and replaced Py_XSETREF with Py_SETREF
...
in places where Py_DECREF was used.
2016-04-10 18:05:40 +03:00
Serhiy Storchaka
ec39756960
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
2016-04-06 09:50:03 +03:00
Serhiy Storchaka
48842714b9
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
2016-04-06 09:45:48 +03: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
Benjamin Peterson
3e47a1337c
merge 3.5
2016-01-01 11:56:35 -06: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
1ed017ae92
Issue #20440 : Cleaning up the code by using Py_SETREF and Py_CLEAR.
...
Old code is correct, but with Py_SETREF and Py_CLEAR it can be cleaner.
This patch doesn't fix bugs and hence there is no need to backport it.
2015-12-27 15:51:32 +02:00
Serhiy Storchaka
bdb908ea54
Issue #20440 : Applied yet one patch for using Py_SETREF.
...
The patch is automatically generated, it replaces the code that uses Py_CLEAR.
2015-12-27 12:38:28 +02:00
Serhiy Storchaka
4a1e70fc31
Issue #20440 : Applied yet one patch for using Py_SETREF.
...
The patch is automatically generated, it replaces the code that uses Py_CLEAR.
2015-12-27 12:36:18 +02:00
Serhiy Storchaka
f006940351
Issue #20440 : Massive replacing unsafe attribute setting code with special
...
macro Py_SETREF.
2015-12-24 10:39:57 +02:00
Serhiy Storchaka
5a57ade58e
Issue #20440 : Massive replacing unsafe attribute setting code with special
...
macro Py_SETREF.
2015-12-24 10:35:59 +02:00
Serhiy Storchaka
a9406e77fa
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:07:11 +02: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
Serhiy Storchaka
4a7c03aab4
Issue #25523 : Merge a-to-an corrections from 3.5.
2015-11-02 14:44:29 +02:00
Serhiy Storchaka
a84f6c3dd3
Issue #25523 : Merge a-to-an corrections from 3.4.
2015-11-02 14:39:05 +02:00
Serhiy Storchaka
d65c9496da
Issue #25523 : Further a-to-an corrections.
2015-11-02 14:10:23 +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
a6ea44aed1
Minor cleanups
2015-08-17 23:55:28 -07:00
Raymond Hettinger
ca3788c2e8
Issue #24874 : Speed-up itertools and make it pickles more compact.
2015-08-16 14:49:24 -07:00
Raymond Hettinger
a6a2d44dc7
Neaten-up whitespace, vertical alignment, and line-wrapping.
2015-08-16 14:38:07 -07:00
Raymond Hettinger
b5244a3fe5
Inline PyIter_Next() matching what was done for other itertools.
2015-08-16 14:24:20 -07:00
Raymond Hettinger
c39786dc08
Fix oddly placed whitespace
2015-08-15 15:16:12 -07:00
Raymond Hettinger
98958fedb6
Remove dead code (unreachable)
2015-08-15 15:09:30 -07:00
Raymond Hettinger
79c878d5f2
Fix crash in itertools.cycle.__setstate__() caused by lack of type checking.
...
Will backport after the 3.6 release is done.
2015-08-15 13:51:59 -07:00
Raymond Hettinger
b468e1f595
Neaten-up vertical alignment of comments
2015-08-14 14:10:49 -07:00
Raymond Hettinger
d2117e18a0
merge
2015-07-28 02:07:14 -07:00
Raymond Hettinger
acd61b6e40
Issue #24735 : Fix invalid memory access in combinations_with_replacement()
2015-07-28 02:05:44 -07:00
Serhiy Storchaka
553e156921
Fixed indentation of Python examples in C comments.
2015-06-11 00:07:47 +03:00
Serhiy Storchaka
d741a88049
Fixed indentation of Python examples in C comments.
2015-06-11 00:06:39 +03:00
Serhiy Storchaka
483405bcca
Issue #22883 : Got rid of outdated references to PyInt and PyString in comments.
2015-02-17 10:14:30 +02:00
Serhiy Storchaka
b5e8e57555
Issues #23363 , #23364 , #23365 , #23366 : Fixed itertools overflow tests.
...
Used PyMem_New to check overflow.
2015-02-03 01:35:10 +02:00
Serhiy Storchaka
dee948b359
Issues #23363 , #23364 , #23365 , #23366 : Fixed itertools overflow tests.
...
Used PyMem_New to check overflow.
2015-02-03 01:34:09 +02:00
Benjamin Peterson
c468b537cd
merge 3.3 ( #23364 , #23363 )
2015-02-01 21:35:34 -05:00
Benjamin Peterson
0eaabf1c05
check for overflows in permutations() and product() ( closes #23363 , closes #23364 )
2015-02-01 21:34:07 -05:00
Benjamin Peterson
f635dc32b1
merge 3.3 ( #23365 )
2015-02-01 21:11:39 -05:00
Benjamin Peterson
6f082297b2
check for overflow in combinations_with_replacement ( closes #23365 )
2015-02-01 21:10:47 -05:00
Benjamin Peterson
819c4e9bc4
merge 3.3 ( #23366 )
2015-02-01 21:00:15 -05:00
Benjamin Peterson
4b40eeb339
detect overflow in combinations ( closes #23366 )
2015-02-01 20:59:00 -05:00
Raymond Hettinger
97d3555029
Issue #19145 : Fix handling of negative values for a "times" keyword argument to itertools.repeat()>
...
(Patch contributed by Vajrasky Kok.)
2014-06-24 21:36:58 -07:00
Antoine Pitrou
26f82efe59
Issue #21321 : itertools.islice() now releases the reference to the source iterator when the slice is exhausted.
...
Patch by Anton Afanasyev.
2014-04-29 12:13:46 +02:00
Serhiy Storchaka
2dae92a807
Issue #15475 : Add __sizeof__ implementations for itertools objects.
2013-12-09 17:45:57 +02:00
Antoine Pitrou
b4a46cb428
Add a comment making it explicit that itertools.tee() is already 64bit-safe (issue #19049 )
2013-09-20 22:19:22 +02:00
Raymond Hettinger
fb92f393b0
Issue 18752: Make chain.from_iterable() more visible in the documentation.
2013-09-09 02:01:35 -05:00
Raymond Hettinger
8df58f7ae8
Issue 18752: Make chain.from_iterable() more visible in the documentation.
2013-09-09 01:29:40 -05:00
Tim Peters
9edb168dd7
cwr_next(): move invariants out of loops.
...
This simplifies and clarifies the code, and gives a small speedup.
2013-09-03 11:49:31 -05:00
Eli Bendersky
c554f725a0
Issue #18912 : Fix indentation in docstring
...
Contributed by Jeroen Van Goey
2013-09-03 06:37:19 -07:00
Andrew Kuchling
da30acf50b
Closes #18220 : expand itertools.islice docstring to 2 lines
2013-06-22 19:20:54 -04:00
Andrew Kuchling
446a39f78f
Close #18285 : add 'repeat' parameter to docstring for product
2013-06-22 19:04:11 -04:00
Andrew Kuchling
b003ffa0ab
Closes #18239 : correct description of count() in module docstring
2013-06-21 07:58:35 -04:00
Serhiy Storchaka
278d03bd66
Revert a premature patch for issue #14010 (changeset aaaf36026511).
2013-04-06 22:52:34 +03:00
Serhiy Storchaka
e8f706eda7
Issue #14010 : Fix a crash when iterating or deleting deeply nested filters
...
(builting and in itertools module, i.e. map(), itertools.chain(), etc).
2013-04-06 21:14:43 +03:00
Serhiy Storchaka
d269b5e73d
Clean trailing whitespace in itertoolsmodule.c.
2013-01-25 13:38:56 +02:00
Serhiy Storchaka
e7e9c32195
Clean trailing whitespace in itertoolsmodule.c.
2013-01-25 13:37:39 +02:00
Serhiy Storchaka
339e91d4cb
Issue #13454 : Fix a crash when deleting an iterator created by itertools.tee()
...
if all other iterators were very advanced before.
2013-01-25 13:24:47 +02:00
Serhiy Storchaka
a3e9128aba
Issue #13454 : Fix a crash when deleting an iterator created by itertools.tee()
...
if all other iterators were very advanced before.
2013-01-25 13:19:31 +02:00
Antoine Pitrou
721738fbee
Issue #15604 : Update uses of PyObject_IsTrue() to check for and handle errors correctly.
...
Patch by Serhiy Storchaka.
2012-08-15 23:20:39 +02:00
Antoine Pitrou
6f430e4963
Issue #15604 : Update uses of PyObject_IsTrue() to check for and handle errors correctly.
...
Patch by Serhiy Storchaka.
2012-08-15 23:18:25 +02:00
Martin v. Löwis
33cac8578b
Add safecase to silence Win64 warning.
2012-05-15 14:34:58 +02:00
Kristján Valur Jónsson
31668b8f7a
Issue #14288 : Serialization support for builtin iterators.
2012-04-03 10:49:41 +00:00
Martin v. Löwis
1c67dd9b15
Port SetAttrString/HasAttrString to SetAttrId/GetAttrId.
2011-10-14 15:16:45 +02:00
Martin v. Löwis
bd928fef42
Rename _Py_identifier to _Py_IDENTIFIER.
2011-10-14 10:20:37 +02:00
Martin v. Löwis
afe55bba33
Add API for static strings, primarily good for identifiers.
...
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Mark Dickinson
a61b053e61
Merge #12973 itertools fix.
2011-09-24 08:57:00 +01:00
Mark Dickinson
b2f6bc72a2
Issue #12973 : Fix itertools bug caused by signed integer overflow. Thanks Stefan Krah.
2011-09-24 08:56:09 +01:00
Kristjan Valur Jonsson
978da33c7a
Merge 3.2
2011-03-30 11:32:06 +00:00
Kristjan Valur Jonsson
fa3edbed25
Merge 3.1
2011-03-30 11:24:58 +00:00
Kristjan Valur Jonsson
35722a9376
Bugfix: Properly test for errors from PyLong_AsLong() in itertools.cycle.
...
ti can raise an exception even if PyLong_Check() has
succeeded.
2011-03-30 11:04:28 +00:00
Raymond Hettinger
5bf7091df0
Update docstrings for itertools.accumulate().
2011-03-27 18:59:51 -07:00
Raymond Hettinger
5d44613e3b
Add optional *func* argument to itertools.accumulate().
2011-03-27 18:52:10 -07:00