File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -592,15 +592,19 @@ func PyCallIter_New(callable, sentinel *PyObject) *PyObject {
592
592
return togo (C .PyCallIter_New (topy (callable ), topy (sentinel )))
593
593
}
594
594
595
- // PyObject * PyCode_NewEmpty(char *filename, char *funcname, int firstlineno)
595
+ // PyCodeObject * PyCode_NewEmpty(char *filename, char *funcname, int firstlineno)
596
596
// 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.
598
598
func PyCode_NewEmpty (filename string , funcname string , firstlineno int ) * PyObject {
599
599
c_filename := C .CString (filename )
600
- c_funcname := C .CString (funcname )
601
600
defer C .free (unsafe .Pointer (c_filename ))
601
+ c_funcname := C .CString (funcname )
602
602
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 )))
604
608
}
605
609
606
610
// EOF
You can’t perform that action at this time.
0 commit comments