8000 otherobjects: reflow PyCode_NewEmpty, more comments · limaochang/go-python@873aabc · GitHub
[go: up one dir, main page]

Skip to content

Commit 873aabc

Browse files
committed
otherobjects: reflow PyCode_NewEmpty, more comments
1 parent ee36858 commit 873aabc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

otherobjects.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff 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.
598598
func 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

0 commit comments

Comments
 (0)
0