Eric Snow <ericsnowcurren...@gmail.com> added the comment:

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.  :)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14942>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to