Raymond Hettinger
3662c9090d
Backport r61286 adding GC to the grouper for itertools.groupby() fixing Issue 2246.
2008-03-06 22:58:42 +00:00
Kristján Valur Jónsson
f4601d874f
Fix two problems that emerged when the testsuite was run with an x64 build: PyLong_FromSSize_t incorrectly assumed an unsigned object, and itertools.count() had the wrong upper limit for the iterator.
2007-05-07 18:30:48 +00:00
Raymond Hettinger
9f0e1ea964
Do not let overflows in enumerate() and count() pass silently.
2007-02-07 23:57:05 +00:00
Georg Brandl
8e932e7d68
Bug #1486663 : don't reject keyword arguments for subclasses of builtin
...
types.
(backport from rev. 53509)
2007-01-21 10:28:56 +00:00
Jack Diederich
187e64806f
backport of r51950
...
* regression bug, count_next was coercing a Py_ssize_t to an unsigned Py_size_t
which breaks negative counts
* added test for negative numbers
2006-09-21 18:32:11 +00:00
Neal Norwitz
7ae5f29465
Backport fix for SF bug #1550714 , itertools.tee raises SystemError
2006-09-05 02:30:10 +00:00
Neal Norwitz
9029b5f289
nextlink can be NULL if teedataobject_new fails, so use XINCREF.
...
Ensure that dataobj is never NULL.
Reported by Klocwork #102
2006-07-23 07:59:00 +00:00
Neal Norwitz
2f3136b8f0
Fix compiler warning (and whitespace) on Mac OS 10.4. (A lot of this code looked duplicated, I wonder if a utility function could help reduce the duplication here.)
2006-05-27 05:18:57 +00:00
Jack Diederich
6c433a91d5
use Py_ssize_t in places that may need it
2006-05-26 11:15:17 +00:00
Thomas Wouters
b3deb94dc6
Add missing PyObject_GC_Track call, causing *some* itertools.tee objects to
...
not be tracked by GC. This fixes 254 of test_generators' refleaks on my
machine, but I'm sure something else will make them come back :>
Not adding a separate test for this kind of cycle, since the existing
fib/m235 already test them in more extensive ways than any 'minimal' test
has been able to manage.
2006-04-15 22:33:13 +00:00
Thomas Wouters
19bf33bc7a
Make itertools.tee and its internal teedataobject participate in GC. This
...
alone does not solve the leak in test_generators, unfortunately, but it is
part of test_generators' problem and it does solve other cycles.
2006-03-27 21:02:13 +00:00
Martin v. Löwis
02cbf4ae4b
More unconsting.
2006-02-27 17:20:04 +00:00
Martin v. Löwis
ad0a4629be
Use Py_ssize_t for counts and sizes.
2006-02-16 14:30:23 +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
Neal Norwitz
1ac754fa10
Check return result from Py_InitModule*(). This API can fail.
...
Probably should be backported.
2006-01-19 06:09:39 +00:00
Jeremy Hylton
af68c874a6
Add const to several API functions that take char *.
...
In C++, it's an error to pass a string literal to a char* function
without a const_cast(). Rather than require every C++ extension
module to put a cast around string literals, fix the API to state the
const-ness.
I focused on parts of the API where people usually pass literals:
PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type
slots, etc. Predictably, there were a large set of functions that
needed to be fixed as a result of these changes. The most pervasive
change was to make the keyword args list passed to
PyArg_ParseTupleAndKewords() to be a const char *kwlist[].
One cast was required as a result of the changes: A type object
mallocs the memory for its tp_doc slot and later frees it.
PyTypeObject says that tp_doc is const char *; but if the type was
created by type_new(), we know it is safe to cast to char *.
2005-12-10 18:50:16 +00:00
Raymond Hettinger
6b27cda643
Convert iterator __len__() methods to a private API.
2005-09-24 21:23:05 +00:00
Georg Brandl
02c42871cf
Disallow keyword arguments for type constructors that don't use them.
...
(fixes bug #1119418 )
2005-08-26 06:42:30 +00:00
Raymond Hettinger
b2594050ea
Added optional None arguments to itertools.islice().
2004-12-05 09:25:51 +00:00
Fred Drake
08ebfec75e
some platforms still need offsetof() from structmember.h
2004-10-17 19:36:57 +00:00
Raymond Hettinger
a9f6092904
Fix and test weak referencing of itertools.tee objects.
2004-10-17 16:40:14 +00:00
Raymond Hettinger
880430e2a5
Replace structure member before decreffing.
2004-10-02 10:56:43 +00:00
Raymond Hettinger
4cda01e260
* Increase test coverage.
...
* Have groupby() be careful about decreffing structure members.
2004-09-28 04:45:28 +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
58ed69b402
Exercise Jim's VISIT macro.
2004-07-15 05:32:47 +00:00