This repository was archived by the owner on Jul 24, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -592,15 +592,19 @@ func PyCallIter_New(callable, sentinel *PyObject) *PyObject {
592592 return togo (C .PyCallIter_New (topy (callable ), topy (sentinel )))
593593}
594594
595- // PyObject * PyCode_NewEmpty(char *filename, char *funcname, int firstlineno)
595+ // PyCodeObject * PyCode_NewEmpty(char *filename, char *funcname, int firstlineno)
596596// Return value: New reference.
597- // Return an empty CodePythonObject that corosponds to the file name, func name and line number in the source file it points to.
597+ // Return an empty CodePythonObject that corresponds to the file name, func name and line number in the source file it points to.
598598func PyCode_NewEmpty (filename string , funcname string , firstlineno int ) * PyObject {
599599 c_filename := C .CString (filename )
600- c_funcname := C .CString (funcname )
601600 defer C .free (unsafe .Pointer (c_filename ))
601+ c_funcname := C .CString (funcname )
602602 defer C .free (unsafe .Pointer (c_funcname ))
603- return togo ((* C .PyObject )(unsafe .Pointer (C .PyCode_NewEmpty (c_filename , c_funcname , C .int (firstlineno )))))
603+
604+ o := C .PyCode_NewEmpty (c_filename , c_funcname , C .int (firstlineno ))
605+
606+ // need to (unsafe-ly) cast to *C.PyObject as o is a *C.PyCodeObject
607+ return togo ((* C .PyObject )(unsafe .Pointer (o )))
604608}
605609
606610// EOF
You can’t perform that action at this time.
0 commit comments