sbinet / go-python

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

fdopen doesn't work on Windows #21

Closed UserAB1236872 closed 9 years ago

UserAB1236872 commented 9 years ago

Write now in object.go it uses file.Fd and C.fdopen. Unfortunately, fdopen doesn't work on windows.

It seems to work for me if I exchange it with

// ...
name := C.CString(file.Name())
defer C.free(unsafe.Pointer(name))
C.fopen(name, cmode)
// ...

But I'm not confident it will always work. I'm not sure if anything can be done, AFAIK the WIndows equivalent to fdopen is pretty gnarly.

sbinet commented 9 years ago

thanks for the report. I left fdopen for POSIX platforms and went with fopen on windows.