[Python-checkins] r51950 - in python/trunk: Lib/test/test_itertools.py Modules/itertoolsmodule.c
Neal Norwitz
nnorwitz at gmail.com
Thu Sep 21 21:35:45 CEST 2006
Can we get a Misc/NEWS entry for this on trunk and in 2.5? Thanks.
On 9/21/06, jack.diederich <python-checkins at python.org> wrote:
> Author: jack.diederich
> Date: Thu Sep 21 19:50:26 2006
> New Revision: 51950
>
> Modified:
> python/trunk/Lib/test/test_itertools.py
> python/trunk/Modules/itertoolsmodule.c
> Log:
> * 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
> will backport to 2.5.1
>
>
> Modified: python/trunk/Lib/test/test_itertools.py
> ==============================================================================
> --- python/trunk/Lib/test/test_itertools.py (original)
> +++ python/trunk/Lib/test/test_itertools.py Thu Sep 21 19:50:26 2006
> @@ -58,6 +58,10 @@
> self.assertEqual(repr(c), 'count(3)')
> c.next()
> self.assertEqual(repr(c), 'count(4)')
> + c = count(-9)
> + self.assertEqual(repr(c), 'count(-9)')
> + c.next()
> + self.assertEqual(c.next(), -8)
>
> def test_cycle(self):
> self.assertEqual(take(10, cycle('abc')), list('abcabcabca'))
>
> Modified: python/trunk/Modules/itertoolsmodule.c
> ==============================================================================
> --- python/trunk/Modules/itertoolsmodule.c (original)
> +++ python/trunk/Modules/itertoolsmodule.c Thu Sep 21 19:50:26 2006
> @@ -2072,7 +2072,7 @@
> static PyObject *
> count_next(countobject *lz)
> {
> - return PyInt_FromSize_t(lz->cnt++);
> + return PyInt_FromSsize_t(lz->cnt++);
> }
>
> static PyObject *
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>
More information about the Python-checkins
mailing list