// Note This function is not available in 3.x and does not have a PyBytes alias. func PyString_AsDecodedObject(self *PyObject, encoding, errors string) *PyObject { c_encoding := C.CString(encoding) defer C.free(unsafe.Pointer(c_encoding)) c_errors := C.CString(errors) defer C.free(unsafe.Pointer(c_errors)) return togo(C.PyString_AsDecodedObject(topy(self), c_encoding, c_errors)) }
func (s *String) Decode(encoding, errors string) (Object, error) { var cEncoding, cErrors *C.char if encoding == "" { cEncoding = C.CString(encoding) defer C.free(unsafe.Pointer(cEncoding)) } if errors != "" { cErrors = C.CString(errors) defer C.free(unsafe.Pointer(cErrors)) } ret := C.PyString_AsDecodedObject(c(s), cEncoding, cErrors) return obj2ObjErr(ret) }