[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-11-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: Forward-ported in r76025 r76026 and r76027. -- resolution: -> fixed status: open -> closed ___ Python tracker ___ __

[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-11-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: Added r76018 to use Hirokazu's test for the RuntimeError case and to redirect stdout to a file for the StopIteration case. Also, fixed-up weird indentation in the C code. -- ___ Python tracker

[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-11-01 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman

[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-11-01 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman

[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-11-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: Will take a look at your patch. Am also still doing work to complete r76004 for the case where the refcnt > 1. -- ___ Python tracker ___

[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-11-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: Already checked-in a fix for Py2.6 in r76004. Will forward port shortly. -- ___ Python tracker ___ __

[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-11-01 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: > correct elements are returned even when RuntimeError is raised. Or maybe it is not guaranteed. :-) -- ___ Python tracker ___ _

[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-11-01 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: I created the patch to improve test which was checked in r76004. This patch checks if correct elements are returned even when RuntimeError is raised. Could you take a look? -- Added file: http://bugs.python.org/file15245/improve_test_itertools.patch

[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-10-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: I've got it from here. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-10-31 Thread Georg Brandl
Georg Brandl added the comment: > I tried your code (with the new-style class) with Python 2.6.4 and 2.7a0 > (trunk), and both worked fine. I built them with GCC 4.2.4 on Ubuntu 8.04. The problem seems to only show up in debug builds on 2.x, but it is there. -- ___

[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-10-31 Thread Daniel Urban
Daniel Urban added the comment: > I saw strange thing with following code + release26-maint/trunk. I tried your code (with the new-style class) with Python 2.6.4 and 2.7a0 (trunk), and both worked fine. I built them with GCC 4.2.4 on Ubuntu 8.04. -- ___

[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-10-31 Thread Georg Brandl
Georg Brandl added the comment: The patch is incorrect; tp_iternext can raise exceptions other than StopIteration which must be let through. -- assignee: -> rhettinger nosy: +georg.brandl, rhettinger ___ Python tracker

[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-10-31 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: I hope an attached patch will fix this issue. (this patch is for trunk) I think PyErr_Clear() is needed to clear StopIteration there. -- keywords: +patch versions: +Python 2.6, Python 2.7, Python 3.2 Added file: http://bugs.python.org/file15239/fix_i

[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-10-31 Thread Hirokazu Yamamoto
Hirokazu Yamamoto added the comment: I saw strange thing with following code + release26-maint/trunk. from itertools import * class Repeater(object): # this class is similar to itertools.repeat def __init__(self, o, t): self.o = o self.t = int(t) def __iter__(self): # its i

[issue7244] itertools.zip_longest behaves strangely with an iterable class

2009-10-31 Thread Daniel Urban
New submission from Daniel Urban : I'm trying to write an iterable class, and it behaves strangely with itertools.zip_longest. The following example demonstrates this: class Repeater: # this class is similar to itertools.repeat def __init__(self, o, t): self.o = o self.t = int(t