-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Closed
Labels
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()) # Nonedef func():
yield 'Hello'
yield 'World'
v = func()
print(next(v)) # Hello
print(v.close()) # None
print(v.close()) # Nonedef func():
yield 'Hello'
yield 'World'
v = func()
print(next(v)) # Hello
print(next(v)) # World
print(v.close()) # None
print(v.close()) # Nonedef func():
yield 'Hello'
yield 'World'
v = func()
print(v.close()) # None
print(next(v)) # StopIterationdef func():
yield 'Hello'
yield 'World'
v = func()
print(next(v)) # Hello
print(v.close()) # None
print(next(v)) # StopIterationCPython versions tested on:
3.13
Operating systems tested on:
Windows
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status
Todo