Using goPy in combination with gccgo it is possible to write CPython extension modules in Go. Once the libraries and command-line tool are installed, the "gopy" command-line tool takes care of generating the necessary C interface code and using gccgo to compile the code into an extension module.


These are the new features in 0.8.0:


There are a few things that should be made clear:

  1. Calling Go code from a second thread will block that thread, whilst the Go code is called by a goroutine running in a thread controlled by the Go runtime. Most of the time this should be invisible, but it could cause problems if that Go code then calls back out to something that expects to be running in the same thread.
  2. Both the goPy bindings and the gccgo specific extension support code have only undergone the lightest of testing
  3. When using goroutines py.Lock must be used. No other GIL or threading interface functions have been tested - and they most likely will not work.
  4. Essentially this code is alpha quality at best, and currently primarily exists as proof that it is possible.