mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	gh-111178: Fix function signatures for PyStdPrinter (#131192)
This commit is contained in:
		
							parent
							
								
									0ddfb5717f
								
							
						
					
					
						commit
						c497f83ad8
					
				
					 1 changed files with 15 additions and 11 deletions
				
			
		| 
						 | 
					@ -303,8 +303,9 @@ PyFile_NewStdPrinter(int fd)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
 | 
					stdprinter_write(PyObject *op, PyObject *args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    PyStdPrinter_Object *self = (PyStdPrinter_Object*)op;
 | 
				
			||||||
    PyObject *unicode;
 | 
					    PyObject *unicode;
 | 
				
			||||||
    PyObject *bytes = NULL;
 | 
					    PyObject *bytes = NULL;
 | 
				
			||||||
    const char *str;
 | 
					    const char *str;
 | 
				
			||||||
| 
						 | 
					@ -355,27 +356,30 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					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);
 | 
					    return PyLong_FromLong((long) self->fd);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					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>",
 | 
					    return PyUnicode_FromFormat("<stdprinter(fd=%d) object at %p>",
 | 
				
			||||||
                                self->fd, self);
 | 
					                                self->fd, self);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
stdprinter_noop(PyStdPrinter_Object *self, PyObject *Py_UNUSED(ignored))
 | 
					stdprinter_noop(PyObject *self, PyObject *Py_UNUSED(ignored))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    Py_RETURN_NONE;
 | 
					    Py_RETURN_NONE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					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;
 | 
					    long res;
 | 
				
			||||||
    if (self->fd < 0) {
 | 
					    if (self->fd < 0) {
 | 
				
			||||||
        Py_RETURN_FALSE;
 | 
					        Py_RETURN_FALSE;
 | 
				
			||||||
| 
						 | 
					@ -389,11 +393,11 @@ stdprinter_isatty(PyStdPrinter_Object *self, PyObject *Py_UNUSED(ignored))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyMethodDef stdprinter_methods[] = {
 | 
					static PyMethodDef stdprinter_methods[] = {
 | 
				
			||||||
    {"close",           (PyCFunction)stdprinter_noop, METH_NOARGS, ""},
 | 
					    {"close", stdprinter_noop, METH_NOARGS, ""},
 | 
				
			||||||
    {"flush",           (PyCFunction)stdprinter_noop, METH_NOARGS, ""},
 | 
					    {"flush", stdprinter_noop, METH_NOARGS, ""},
 | 
				
			||||||
    {"fileno",          (PyCFunction)stdprinter_fileno, METH_NOARGS, ""},
 | 
					    {"fileno", stdprinter_fileno, METH_NOARGS, ""},
 | 
				
			||||||
    {"isatty",          (PyCFunction)stdprinter_isatty, METH_NOARGS, ""},
 | 
					    {"isatty", stdprinter_isatty, METH_NOARGS, ""},
 | 
				
			||||||
    {"write",           (PyCFunction)stdprinter_write, METH_VARARGS, ""},
 | 
					    {"write", stdprinter_write, METH_VARARGS, ""},
 | 
				
			||||||
    {NULL,              NULL}  /*sentinel */
 | 
					    {NULL,              NULL}  /*sentinel */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -433,7 +437,7 @@ PyTypeObject PyStdPrinter_Type = {
 | 
				
			||||||
    0,                                          /* tp_getattr */
 | 
					    0,                                          /* tp_getattr */
 | 
				
			||||||
    0,                                          /* tp_setattr */
 | 
					    0,                                          /* tp_setattr */
 | 
				
			||||||
    0,                                          /* tp_as_async */
 | 
					    0,                                          /* tp_as_async */
 | 
				
			||||||
    (reprfunc)stdprinter_repr,                  /* tp_repr */
 | 
					    stdprinter_repr,                            /* tp_repr */
 | 
				
			||||||
    0,                                          /* tp_as_number */
 | 
					    0,                                          /* tp_as_number */
 | 
				
			||||||
    0,                                          /* tp_as_sequence */
 | 
					    0,                                          /* tp_as_sequence */
 | 
				
			||||||
    0,                                          /* tp_as_mapping */
 | 
					    0,                                          /* tp_as_mapping */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue