Skip to content

Commit 33cbbd1

Browse files
committed
Fix repeated close
1 parent e1f5b61 commit 33cbbd1

File tree

1 file changed

+1
-1
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/generator

1 file changed

+1
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/generator/GeneratorBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ Object close(VirtualFrame frame, PGenerator self,
472472
if (self.isRunning()) {
473473
throw raise(ValueError, ErrorMessages.GENERATOR_ALREADY_EXECUTING);
474474
}
475-
if (isStartedPorfile.profile(self.isStarted())) {
475+
if (isStartedPorfile.profile(self.isStarted() && !self.isFinished())) {
476476
PBaseException pythonException = factory().createBaseException(GeneratorExit);
477477
// Pass it to the generator where it will be thrown by the last yield, the location
478478
// will be filled there

0 commit comments

Comments
 (0)