mirror of
https://github.com/samba-team/samba.git
synced 2025-07-15 16:59:09 +03:00
pidl/python: Support repr() for python types.
(This used to be commit cf3664594d
)
This commit is contained in:
@ -22,7 +22,7 @@
|
||||
void py_talloc_dealloc(PyObject* self)
|
||||
{
|
||||
py_talloc_Object *obj = (py_talloc_Object *)self;
|
||||
talloc_free(obj->object);
|
||||
talloc_free(obj->talloc_ptr);
|
||||
PyObject_Del(self);
|
||||
}
|
||||
|
||||
@ -32,3 +32,11 @@ PyObject *py_talloc_import(PyTypeObject *py_type, void *ptr)
|
||||
ret->talloc_ptr = talloc_reference(NULL, ptr);
|
||||
return ret;
|
||||
}
|
||||
|
||||
PyObject *py_talloc_default_repr(PyObject *py_obj)
|
||||
{
|
||||
py_talloc_Object *obj = (py_talloc_Object *)py_obj;
|
||||
|
||||
return PyString_FromFormat("<talloc: %s>",
|
||||
talloc_get_name(obj->talloc_ptr));
|
||||
}
|
||||
|
@ -40,4 +40,7 @@ void py_talloc_dealloc(PyObject* self);
|
||||
|
||||
PyObject *py_talloc_import(PyTypeObject *py_type, void *ptr);
|
||||
|
||||
/* Sane default implementation of reprfunc. */
|
||||
PyObject *py_talloc_default_repr(PyObject *py_obj);
|
||||
|
||||
#endif /* _PY_TALLOC_H_ */
|
||||
|
Reference in New Issue
Block a user