From ac00f4306e17c0f6685d657b5cd183c7171f14db Mon Sep 17 00:00:00 2001 From: Paul Pogonyshev Date: Mon, 9 Jun 2008 19:42:28 +0000 Subject: New functions, unconditionally raise TypeError. (pygobject_methods): Hook 2008-06-09 Paul Pogonyshev * gobject/pygobject.c (pygobject_copy, pygobject_deepcopy): New functions, unconditionally raise TypeError. (pygobject_methods): Hook them up. (bug #482370) svn path=/trunk/; revision=787 --- ChangeLog | 6 ++++++ gobject/pygobject.c | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/ChangeLog b/ChangeLog index a4068d1..d3fee55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-06-09 Paul Pogonyshev + + * gobject/pygobject.c (pygobject_copy, pygobject_deepcopy): New + functions, unconditionally raise TypeError. + (pygobject_methods): Hook them up. (bug #482370) + 2008-05-31 Johan Dahlin * setup.py: set FFI_LIBS to '', since this is mostly used on win32. diff --git a/gobject/pygobject.c b/gobject/pygobject.c index 0754984..4563500 100644 --- a/gobject/pygobject.c +++ b/gobject/pygobject.c @@ -1865,6 +1865,24 @@ pygobject_weak_ref(PyGObject *self, PyObject *args) return retval; } + +static PyObject * +pygobject_copy(PyGObject *self) +{ + PyErr_SetString(PyExc_TypeError, + "gobject.GObject descendants' instances are non-copyable"); + return NULL; +} + +static PyObject * +pygobject_deepcopy(PyGObject *self, PyObject *args) +{ + PyErr_SetString(PyExc_TypeError, + "gobject.GObject descendants' instances are non-copyable"); + return NULL; +} + + static PyObject * pygobject_disconnect_by_func(PyGObject *self, PyObject *args) { @@ -1990,6 +2008,8 @@ static PyMethodDef pygobject_methods[] = { { "emit_stop_by_name", (PyCFunction)pygobject_stop_emission,METH_VARARGS }, { "chain", (PyCFunction)pygobject_chain_from_overridden,METH_VARARGS }, { "weak_ref", (PyCFunction)pygobject_weak_ref, METH_VARARGS }, + { "__copy__", (PyCFunction)pygobject_copy, METH_NOARGS }, + { "__deepcopy__", (PyCFunction)pygobject_deepcopy, METH_VARARGS }, { NULL, NULL, 0 } }; -- cgit