From c7036ce486a41fcb66e04f59cfff280a08463a6e Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 25 Jan 2016 14:30:23 +1100 Subject: [PATCH] python: add mark_to_mark interface Signed-off-by: NeilBrown --- lang-python.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lang-python.c b/lang-python.c index 7ee0af33..acc3ab72 100644 --- a/lang-python.c +++ b/lang-python.c @@ -805,6 +805,24 @@ static void mark_dealloc(Mark *self) self->ob_type->tp_free((PyObject*)self); } +static PyObject *Mark_to_mark(Mark *self, PyObject *args) +{ + Mark *other = NULL; + int ret = PyArg_ParseTuple(args, "O!", &MarkType, &other); + if (ret <= 0) + return NULL; + mark_to_mark(self->mark, other->mark); + + Py_INCREF(Py_None); + return Py_None; +} + +static PyMethodDef mark_methods[] = { + {"to_mark", (PyCFunction)Mark_to_mark, METH_VARARGS, + "Move one mark to another"}, + {NULL} +}; + static PyTypeObject MarkType = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ @@ -834,7 +852,7 @@ static PyTypeObject MarkType = { 0, /* tp_weaklistoffset */ (getiterfunc)mark_this, /* tp_iter */ (iternextfunc)Mark_next, /* tp_iternext */ - 0, /* tp_methods */ + mark_methods, /* tp_methods */ 0, /* tp_members */ mark_getseters, /* tp_getset */ 0, /* tp_base */ -- 2.39.5