Mercurial > pymonkey
diff object.c @ 77:755af0a94c94
Added a pymonkey.Object.get_runtime() method.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Fri, 07 Aug 2009 11:20:12 -0700 |
parents | b0360c0ed546 |
children | 9e8e56b4de6f |
line wrap: on
line diff
--- a/object.c Fri Aug 07 11:02:56 2009 -0700 +++ b/object.c Fri Aug 07 11:20:12 2009 -0700 @@ -130,6 +130,19 @@ self->ob_type->tp_free((PyObject *) self); } +static PyObject * +PYM_getRuntime(PYM_JSObject *self, PyObject *args) +{ + Py_INCREF(self->runtime); + return (PyObject *) self->runtime; +} + +static PyMethodDef PYM_JSObjectMethods[] = { + {"get_runtime", (PyCFunction) PYM_getRuntime, METH_VARARGS, + "Get the JavaScript runtime associated with this object."}, + {NULL, NULL, 0, NULL} +}; + PyTypeObject PYM_JSObjectType = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ @@ -162,7 +175,7 @@ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - 0, /* tp_methods */ + PYM_JSObjectMethods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */