Make map() and zip() clean up after StopIteration
This came to light because of this issue report: https://github.com/google/grumpy/issues/305 Basically, map() and zip() were detecting StopIteration but were calling ExcRestore(nil, nil) in the wrong place, so under normal circumstances, exc info would be set to StopIteration after they returned. Normally this would not cause a problem, but the code in the bug report was calling a native function (time.Now()) subsequent to a map() and nativeInvoke checks ExcInfo() to determine whether the Go function manually triggered an exception. See: https://github.com/google/grumpy/blob/master/runtime/native.go#L572 In this case, nativeInvoke was being fooled because exc info had been set previously. nativeInvoke should probably be smarter about this by resetting the exception before the native call.
Showing
Please register or sign in to comment