Victor Stinner
559bb6a713
Rename _PyObject_FastCall() to _PyObject_FastCallDict()
...
Issue #27809 :
* Rename _PyObject_FastCall() function to _PyObject_FastCallDict()
* Add _PyObject_FastCall(), _PyObject_CallNoArg() and _PyObject_CallArg1()
macros calling _PyObject_FastCallDict()
2016-08-22 22:48:54 +02:00
Victor Stinner
99ee9c70a7
calliter_iternext() now uses fast call
...
Issue #27128 : calliter_iternext() now calls _PyObject_FastCall() to avoid a
temporary empty tuple.
Cleanup also the code to reduce the indentation level.
2016-08-19 18:47:10 +02: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
b2f3c2357c
Issue #23985 : Fixed integer overflow in iterator object. Patch by
...
Clement Rouault.
2015-05-21 20:51:53 +03:00
Serhiy Storchaka
4faf5c5655
Issue #23985 : Fixed integer overflow in iterator object. Patch by
...
Clement Rouault.
2015-05-21 20:50:25 +03:00
Serhiy Storchaka
009b811d67
Removed unintentional trailing spaces in non-external and non-generated C files.
2015-03-18 21:53:15 +02:00
Victor Stinner
e0b99ba140
Close #17932 : Fix an integer overflow issue on Windows 64-bit in iterators:
...
change the C type of seqiterobject.it_index from long to Py_ssize_t.
2013-06-04 23:02:46 +02:00
Armin Ronacher
23c5bb4030
Fixed a missing incref introduced by a7ec0a1b0f7c
2012-10-06 14:30:32 +02:00
Armin Ronacher
aa9a79d279
Issue #16148 : implemented PEP 424
2012-10-06 14:03:24 +02:00
Antoine Pitrou
a701388de1
Rename _PyIter_GetBuiltin to _PyObject_GetBuiltin, and do not include it in the stable ABI.
2012-04-05 00:04:20 +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
1b66996281
Fix nit (sentinel on lhs of comparison).
2010-08-07 05:54:08 +00:00
Antoine Pitrou
f95a1b3c53
Recorded merge of revisions 81029 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/trunk
........
r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines
Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Mark Dickinson
e94c679df0
Issue #1717 : rename tp_compare to tp_reserved. I'll change the
...
type of tp_compare in a separate commit, for ease of reversion
should things go wrong.
2009-02-02 20:36:42 +00:00
Raymond Hettinger
736c0ab428
Move itertools izip() code to builtins as zip(). Complete the renaming.
2008-03-13 02:09:15 +00:00
Christian Heimes
90aa7646af
#1629 : Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
2007-12-19 02:45:37 +00:00
Christian Heimes
217cfd1c86
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
2007-12-02 14:31:20 +00:00
Christian Heimes
a22e8bdfd9
Added all PyTypeObjects to the appropriate header files.
...
Before the patch a lot of internal types weren't available in the header files. The patch exposes the new iterators, views and some other types to all C modules. I've also renamed some of the types and tp_names.
2007-11-29 22:35:39 +00:00
Christian Heimes
f83be4e3f3
Added view and iterator types to collections / _abcoll
...
I've also renamed several of the iterators to keep a consistent naming schema.
2007-11-28 09:44:38 +00:00
Martin v. Löwis
9f2e346911
Merged revisions 56467-56482 via svnmerge from
...
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r56477 | martin.v.loewis | 2007-07-21 09:04:38 +0200 (Sa, 21 Jul 2007) | 11 lines
Merged revisions 56466-56476 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r56476 | martin.v.loewis | 2007-07-21 08:55:02 +0200 (Sa, 21 Jul 2007) | 4 lines
PEP 3123: Provide forward compatibility with Python 3.0, while keeping
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.
........
................
r56478 | martin.v.loewis | 2007-07-21 09:47:23 +0200 (Sa, 21 Jul 2007) | 2 lines
PEP 3123: Use proper C inheritance for PyObject.
................
r56479 | martin.v.loewis | 2007-07-21 10:06:55 +0200 (Sa, 21 Jul 2007) | 3 lines
Add longintrepr.h to Python.h, so that the compiler can
see that PyFalse is really some kind of PyObject*.
................
r56480 | martin.v.loewis | 2007-07-21 10:47:18 +0200 (Sa, 21 Jul 2007) | 2 lines
Qualify SHIFT, MASK, BASE.
................
r56482 | martin.v.loewis | 2007-07-21 19:10:57 +0200 (Sa, 21 Jul 2007) | 2 lines
Correctly refer to _ob_next.
................
2007-07-21 17:22:18 +00:00
Martin v. Löwis
21298cfea6
Remove bogus INCREF of ziptuple: it is a
...
freshly-allocated tuple object.
2007-02-06 21:30:59 +00:00
Guido van Rossum
59baa759e4
The daily ritual: fix C89 violations.
2006-08-26 02:54:40 +00:00
Guido van Rossum
b65fb33b02
SF patch 1546297 (with some tweaks):
...
Create a real zip iterator object; not using itertools.izip
(Brian Holmes).
2006-08-25 23:26:40 +00:00
Thomas Wouters
49fd7fa443
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
...
number of tests, all because of the codecs/_multibytecodecs issue described
here (it's not a Py3K issue, just something Py3K discovers):
http://mail.python.org/pipermail/python-dev/2006-April/064051.html
Hye-Shik Chang promised to look for a fix, so no need to fix it here. The
tests that are expected to break are:
test_codecencodings_cn
test_codecencodings_hk
test_codecencodings_jp
test_codecencodings_kr
test_codecencodings_tw
test_codecs
test_multibytecodec
This merge fixes an actual test failure (test_weakref) in this branch,
though, so I believe merging is the right thing to do anyway.
2006-04-21 10:40:58 +00:00
Martin v. Löwis
eb079f1c25
Use Py_ssize_t for counts and sizes.
...
Convert Py_ssize_t using PyInt_FromSsize_t
2006-02-16 14:32:27 +00:00
Martin v. Löwis
18e165558b
Merge ssize_t branch.
2006-02-15 17:27:45 +00:00
Armin Rigo
f5b3e36493
Renamed _length_cue() to __length_hint__(). See:
...
http://mail.python.org/pipermail/python-dev/2006-February/060524.html
2006-02-11 21:32:43 +00:00
Raymond Hettinger
6b27cda643
Convert iterator __len__() methods to a private API.
2005-09-24 21:23:05 +00:00
Raymond Hettinger
75ccea3777
SF patch #1020188 : Use Py_CLEAR where necessary to avoid crashes
...
(Contributed by Dima Dorfman)
2004-09-01 07:02:44 +00:00
Raymond Hettinger
7892b1c651
* Add unittests for iterators that report their length
...
* Document the differences between them
* Fix corner cases covered by the unittests
* Use Py_RETURN_NONE where possible for dictionaries
2004-04-12 18:10:01 +00:00
Raymond Hettinger
435bf58b7b
Make iterators length transparent where possible.
2004-03-18 22:43:10 +00:00
Walter Dörwald
03f6c54359
Whitespace normalization.
2003-06-25 13:12:18 +00:00
Raymond Hettinger
1da1dbf458
Renamed PyObject_GenericGetIter to PyObject_SelfIter
...
to more accurately describe what the function does.
Suggested by Thomas Wouters.
2003-03-17 19:46:11 +00:00
Raymond Hettinger
0153826964
Created PyObject_GenericGetIter().
...
Factors out the common case of returning self.
2003-03-17 08:24:35 +00:00
Guido van Rossum
84b2bed435
Squash a few calls to the hideously expensive PyObject_CallObject(o,a)
...
-- replace then with slightly faster PyObject_Call(o,a,NULL). (The
difference is that the latter requires a to be a tuple; the former
allows other values and wraps them in a tuple if necessary; it
involves two more levels of C function calls to accomplish all that.)
2002-08-16 17:01:09 +00:00
Raymond Hettinger
48923c5533
Moved special case for tuples from iterobject.c to
...
tupleobject.c. Makes the code in iterobject.c cleaner
and speeds-up the general case by not checking for
tuples everytime. SF Patch #592065 .
2002-08-09 01:30:17 +00:00
Guido van Rossum
613bed3726
Make StopIteration a sink state. This is done by clearing out the
...
object references (it_seq for seqiterobject, it_callable and
it_sentinel for calliterobject) when the end of the list is reached.
Also remove the next() methods -- one is supplied automatically by
PyType_Ready() because the tp_iternext slot is set. That's a good
thing, because the implementation given here was buggy (it never
raised StopIteration).
2002-07-16 20:24:46 +00:00
Raymond Hettinger
14bd6de0ec
SF 560736. Optimize list iteration by filling the tp_iter slot.
2002-05-31 21:40:38 +00:00
Martin v. Löwis
01f94bda38
Patch #552433 : Special-case tuples. Avoid sub-type checking for lists.
...
Avoid checks for negative indices and duplicate checks for support of
the sequence protocol.
2002-05-08 08:44:21 +00:00
Neil Schemenauer
dbf409fbfc
Re-enable GC of iter objects.
2002-03-18 20:43:51 +00:00
Martin v. Löwis
e3eb1f2b23
Patch #427190 : Implement and use METH_NOARGS and METH_O.
2001-08-16 13:15:00 +00:00
Tim Peters
6d6c1a35e0
Merge of descr-branch back into trunk.
2001-08-02 04:15:00 +00:00
Neil Schemenauer
7eac9b72d4
GC for iterator objects.
2001-07-12 13:27:25 +00:00
Guido van Rossum
47668928e6
Discard a misleading comment about iter_iternext().
2001-05-01 17:01:25 +00:00
Guido van Rossum
213c7a6aa5
Mondo changes to the iterator stuff, without changing how Python code
...
sees it (test_iter.py is unchanged).
- Added a tp_iternext slot, which calls the iterator's next() method;
this is much faster for built-in iterators over built-in types
such as lists and dicts, speeding up pybench's ForLoop with about
25% compared to Python 2.1. (Now there's a good argument for
iterators. ;-)
- Renamed the built-in sequence iterator SeqIter, affecting the C API
functions for it. (This frees up the PyIter prefix for generic
iterator operations.)
- Added PyIter_Check(obj), which checks that obj's type has a
tp_iternext slot and that the proper feature flag is set.
- Added PyIter_Next(obj) which calls the tp_iternext slot. It has a
somewhat complex return condition due to the need for speed: when it
returns NULL, it may not have set an exception condition, meaning
the iterator is exhausted; when the exception StopIteration is set
(or a derived exception class), it means the same thing; any other
exception means some other error occurred.
2001-04-23 14:08:49 +00:00
Guido van Rossum
05311481d4
Adding iterobject.[ch], which were accidentally not added. Sorry\!
2001-04-20 21:06:46 +00:00