◐ Shell
clean mode source ↗

Message 392416 - Python tracker

PyStdPrinter_Type implements tp_new, but tp_init always fail:

static int
stdprinter_init(PyObject *self, PyObject *args, PyObject *kwds)
{
    PyErr_SetString(PyExc_TypeError,
                    "cannot create 'stderrprinter' instances");
    return -1;
}

Maybe it should use the Py_TPFLAGS_IMMUTABLETYPE flag instead?

Instances must be created with PyFile_NewStdPrinter() which doesn't use tp_new nor tp_init.

Erlend: do you want to propose a PR?