Open
Description
Bug report
Bug description:
The doc of generator.close()
says as shown below:
Raises a GeneratorExit at the point where the generator function was paused.
But generator.close()
never raises GeneratorExit
as shown below:
def func():
yield 'Hello'
yield 'World'
v = func()
print(v.close()) # None
print(v.close()) # None
def func():
yield 'Hello'
yield 'World'
v = func()
print(next(v)) # Hello
print(v.close()) # None
print(v.close()) # None
def func():
yield 'Hello'
yield 'World'
v = func()
print(next(v)) # Hello
print(next(v)) # World
print(v.close()) # None
print(v.close()) # None
def func():
yield 'Hello'
yield 'World'
v = func()
print(v.close()) # None
print(next(v)) # StopIteration
def func():
yield 'Hello'
yield 'World'
v = func()
print(next(v)) # Hello
print(v.close()) # None
print(next(v)) # StopIteration
CPython versions tested on:
3.13
Operating systems tested on:
Windows
Linked PRs
Metadata
Metadata
Assignees
Projects
Status
Todo