Closed
Description
Go version
devel go1.23-a3a584e4ab Wed May 29 13:52:34 2024 +0000
Output of go env
in your module/workspace:
n/a since this was tested on the playground (gotip)
What did you do?
Run this on the playground
package main
import (
"fmt"
"iter"
"runtime"
)
func main() {
fmt.Println(runtime.Version())
defer func() {
if err := recover(); err != nil {
fmt.Println(err)
}
}()
next, _ := iter.Pull[int](func(yield func(int) bool) {
yield(1)
panic("!")
})
fmt.Println(next())
fmt.Println(next())
}
https://go.dev/play/p/_BjecTfmPE8?v=gotip
What did you see happen?
The panic is not caught at recover()
devel go1.23-a3a584e4ab Wed May 29 13:52:34 2024 +0000
1 true
panic: !
goroutine 4 [running]:
main.main.func2(0x0?)
/tmp/sandbox4071758638/prog.go:18 +0x2e
iter.Pull[...].func1()
/usr/local/go-faketime/src/iter/iter.go:75 +0x10b
created by iter.Pull[...] in goroutine 1
/usr/local/go-faketime/src/iter/iter.go:59 +0x119
What did you expect to see?
The panic is caught at recover()
Metadata
Metadata
Assignees
Type
Projects
Status
Done
Status
Approved