Exemple #1
0
// PyObject* PyDict_GetItemString(PyObject *p, const char *key)
// Return value: Borrowed reference.
// This is the same as PyDict_GetItem(), but key is specified as a char*, rather than a PyObject*.
func PyDict_GetItemString(self *PyObject, key string) *PyObject {
	c_key := C.CString(key)
	defer C.free(unsafe.Pointer(c_key))

	return togo(C.PyDict_GetItemString(topy(self), c_key))
}
Exemple #2
0
// GetItemString returns the Object from dictionary d which has the key "key"
// (or rather, which has a *String with the value of "key" as the key).  If
// there is no such Object, then nil is returned (without an error).
//
// Return value: Borrowed Reference.
func (d *Dict) GetItemString(key string) (Object, error) {
	s := C.CString(key)
	defer C.free(unsafe.Pointer(s))
	ret := C.PyDict_GetItemString(c(d), s)
	return obj2ObjErr(ret)
}
Exemple #3
0
// GetItemString returns the Object from dictionary d which has the key "key"
// (or rather, which has a *String with the value of "key" as the key).  If
// there is no such Object, then nil is returned (without an error).
//
// Return value: Borrowed Reference.
func (d *Dict) GetItemString(key string) *Base {
	s := C.CString(key)
	defer C.free(unsafe.Pointer(s))
	ret := C.PyDict_GetItemString(d.c(), s)
	return newObject(ret)
}