traefik / yaegi

Yaegi is Another Elegant Go Interpreter

Home Page:https://pkg.go.dev/github.com/traefik/yaegi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

panic on assignment to math.NaN()

bbp-brieuc opened this issue · comments

The following program sample.go triggers a panic

package main

import (
	"fmt"

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


func main() {
	interpreter := interp.New(interp.Options{})
	interpreter.Use(stdlib.Symbols)
	fmt.Println(interpreter.Eval("import \"math\""))
	// the line below triggers a panic
	// it should fail since the code to interpret is invalid, but not panic
	fmt.Println(interpreter.Eval("math.NaN() <- 4"))
}

Expected result

0xc0000b8420 <nil>
<invalid reflect.Value> runtime error: invalid memory address or nil pointer dereference

Got

a panic about a nil pointer dereference

Yaegi Version

v0.14.2

Additional Notes

No response