diff options
author | Guido van Rossum <guido@python.org> | 2002-06-12 03:45:21 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-06-12 03:45:21 (GMT) |
commit | c5fe5eb8d2650026ae7ce9195cd0dfc153514d2a (patch) | |
tree | a3244f08eeb082ad3c54f572340d426db313a573 /Lib/test | |
parent | 969de458aa12e831942637bbcd9994b29dc86252 (diff) | |
download | cpython-c5fe5eb8d2650026ae7ce9195cd0dfc153514d2a.zip cpython-c5fe5eb8d2650026ae7ce9195cd0dfc153514d2a.tar.gz cpython-c5fe5eb8d2650026ae7ce9195cd0dfc153514d2a.tar.bz2 |
SF bug 567538: Generator can crash the interpreter (Finn Bock).
This was a simple typo. Strange that the compiler didn't catch it!
Instead of WHY_CONTINUE, two tests used CONTINUE_LOOP, which isn't a
why_code at all, but an opcode; but even though 'why' is declared as
an enum, comparing it to an int is apparently not even worth a
warning -- not in gcc, and not in VC++. :-(
Will fix in 2.2 too.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_generators.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index 77c477f..17523ba 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -805,6 +805,26 @@ SyntaxError: invalid syntax ... yield 2 # because it's a generator Traceback (most recent call last): SyntaxError: 'return' with argument inside generator (<string>, line 8) + +This one caused a crash (see SF bug 567538): + +>>> def f(): +... for i in range(3): +... try: +... continue +... finally: +... yield i +... +>>> g = f() +>>> print g.next() +0 +>>> print g.next() +1 +>>> print g.next() +2 +>>> print g.next() +Traceback (most recent call last): +StopIteration """ # conjoin is a simple backtracking generator, named in honor of Icon's |