Message161849
Presumably you mean something like this:
<examples>
PyObject *
PyType_New(PyObject *name, PyObject *bases, PyObject *ns)
{
PyObject *type, *args, *newtype;
PyInterpreterState *interp = PyThreadState_GET()->interp;
PyObject *modules = interp->modules;
PyObject *builtins = PyDict_GetItemString(modules, "builtins");
_Py_IDENTIFIER(type);
if (builtins == NULL)
return NULL;
type = _PyObject_GetAttrId(builtins, &PyId_type);
if (type == NULL)
return NULL;
args = PyTuple_Pack(3, name, bases, ns);
if (args == NULL)
return NULL;
newtype = PyObject_CallObject(type, args);
Py_DECREF(args);
return newtype;
}
or even:
PyObject *
PyType_New(PyObject *meta, PyObject *name, PyObject *bases, PyObject *ns)
{
PyObject *args, *newtype;
args = PyTuple_Pack(3, name, bases, ns);
if (args == NULL)
return NULL;
newtype = PyObject_CallObject(type, args);
Py_DECREF(args);
return newtype;
}
and called with "PyType_New(&PyTypeObject, name, bases, ns)".
</examples>
If that's what you meant, I'm okay with that. Otherwise please elaborate. :) |
|
Date |
User |
Action |
Args |
2012-05-29 04:22:25 | eric.snow | set | recipients:
+ eric.snow, ncoghlan |
2012-05-29 04:22:25 | eric.snow | set | messageid: <1338265345.18.0.815759022315.issue14942@psf.upfronthosting.co.za> |
2012-05-29 04:22:24 | eric.snow | link | issue14942 messages |
2012-05-29 04:22:24 | eric.snow | create | |
|