sbinet / go-python

naive go bindings to the CPython2 C-API
Other
1.53k stars 138 forks source link

PyErr_Fetch always causes a nil pointer exception #37

Closed mischief closed 8 years ago

mischief commented 8 years ago

the code

func PyErr_Fetch() (exc, val, tb *PyObject) {
    C.PyErr_Fetch(&exc.ptr, &val.ptr, &tb.ptr)
    return
}

will always cause a nil pointer exception because of the deref of the pointer return values. is this intentional?

sbinet commented 8 years ago

good catch. fixed + added a test.

mischief commented 8 years ago

i think you maybe missed a file in your commit.

$ go test -v -run TestErrFetch
=== RUN   TestErrFetch
--- FAIL: TestErrFetch (0.00s)
        python_test.go:53: [tests/errfetch]: error running go-python test: chdir tests/errfetch: no such file or directory

FAIL
exit status 1
FAIL    github.com/sbinet/go-python     0.003s
sbinet commented 8 years ago

yep. fixed w/ 2d6a486

mischief commented 8 years ago

thank you!