Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calling Symbols("") on new interpreter with stdlib.Symbols crashes with panic: reflect: call of MakeFunc with non-Func type #1629

Open
rcoreilly opened this issue May 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@rcoreilly
Copy link
Contributor

The following program sample.go triggers an unexpected result

package main

import (
        "fmt"

        "github.com/traefik/yaegi/interp"
        "github.com/traefik/yaegi/stdlib"
)

func main() {
        i := interp.New(interp.Options{})
        i.Use(stdlib.Symbols) // commenting out this line prevents crash
        syms := i.Symbols("")
        fmt.Println(syms)
}

Expected result

$ go run ./sample.go

// lots of symbols here

Got

$ go run ./sample.go 
panic: reflect: call of MakeFunc with non-Func type

goroutine 1 [running]:
reflect.MakeFunc({0x100dfb588, 0x100cfe680}, 0x140003cbe40)
	/opt/homebrew/Cellar/go/1.22.1/libexec/src/reflect/makefunc.go:48 +0x17c
github.com/traefik/yaegi/interp.genFunctionWrapper.func1(0x140000e0420)
	/Users/oreilly/go/pkg/mod/github.com/traefik/[email protected]/interp/run.go:991 +0xe8
github.com/traefik/yaegi/interp.(*Interpreter).Symbols(0x14000034d88, {0x0, 0x0})
	/Users/oreilly/go/pkg/mod/github.com/traefik/[email protected]/interp/use.go:38 +0x408
main.main()
	/Users/oreilly/tmp/test/sample.go:13 +0x58
exit status 2

Yaegi Version

v0.16.1

Additional Notes

$ go version
go version go1.22.1 darwin/arm64

macbook

@ldez ldez added the bug Something isn't working label May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants