}
static PyObject *
-stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
+stdprinter_write(PyObject *op, PyObject *args)
{
+ PyStdPrinter_Object *self = (PyStdPrinter_Object*)op;
PyObject *unicode;
PyObject *bytes = NULL;
const char *str;
}
static PyObject *
-stdprinter_fileno(PyStdPrinter_Object *self, PyObject *Py_UNUSED(ignored))
+stdprinter_fileno(PyObject *op, PyObject *Py_UNUSED(ignored))
{
+ PyStdPrinter_Object *self = (PyStdPrinter_Object*)op;
return PyLong_FromLong((long) self->fd);
}
static PyObject *
-stdprinter_repr(PyStdPrinter_Object *self)
+stdprinter_repr(PyObject *op)
{
+ PyStdPrinter_Object *self = (PyStdPrinter_Object*)op;
return PyUnicode_FromFormat("<stdprinter(fd=%d) object at %p>",
self->fd, self);
}
static PyObject *
-stdprinter_noop(PyStdPrinter_Object *self, PyObject *Py_UNUSED(ignored))
+stdprinter_noop(PyObject *self, PyObject *Py_UNUSED(ignored))
{
Py_RETURN_NONE;
}
static PyObject *
-stdprinter_isatty(PyStdPrinter_Object *self, PyObject *Py_UNUSED(ignored))
+stdprinter_isatty(PyObject *op, PyObject *Py_UNUSED(ignored))
{
+ PyStdPrinter_Object *self = (PyStdPrinter_Object*)op;
long res;
if (self->fd < 0) {
Py_RETURN_FALSE;
}
static PyMethodDef stdprinter_methods[] = {
- {"close", (PyCFunction)stdprinter_noop, METH_NOARGS, ""},
- {"flush", (PyCFunction)stdprinter_noop, METH_NOARGS, ""},
- {"fileno", (PyCFunction)stdprinter_fileno, METH_NOARGS, ""},
- {"isatty", (PyCFunction)stdprinter_isatty, METH_NOARGS, ""},
- {"write", (PyCFunction)stdprinter_write, METH_VARARGS, ""},
+ {"close", stdprinter_noop, METH_NOARGS, ""},
+ {"flush", stdprinter_noop, METH_NOARGS, ""},
+ {"fileno", stdprinter_fileno, METH_NOARGS, ""},
+ {"isatty", stdprinter_isatty, METH_NOARGS, ""},
+ {"write", stdprinter_write, METH_VARARGS, ""},
{NULL, NULL} /*sentinel */
};
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_as_async */
- (reprfunc)stdprinter_repr, /* tp_repr */
+ stdprinter_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */