talloc: add pytalloc_get_name() helper
[npower/samba.git] / lib / talloc / pytalloc_util.c
index 7a426d6c2a60cc1ed365a40cf15b78f6fba687b5..82b95e7f144fec1f60aa032172e61ca22481c666 100644 (file)
@@ -331,3 +331,12 @@ _PUBLIC_ int pytalloc_BaseObject_PyType_Ready(PyTypeObject *type)
 
        return PyType_Ready(type);
 }
+
+_PUBLIC_ const char *_pytalloc_get_name(PyObject *obj)
+{
+       void *ptr = pytalloc_get_ptr(obj);
+       if (ptr == NULL) {
+               return "non-talloc object";
+       }
+       return talloc_get_name(ptr);
+}