Skip to content

Commit 1607278

Browse files
committed
Let's do as Guido says and return None instead of -1
1 parent af935e3 commit 1607278

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Objects/fileobject.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
387387
* I can't raise an exception here. It may lead to an
388388
* unlimited recursion in the case stderr is invalid.
389389
*/
390-
return PyLong_FromLong((long)-1);
390+
Py_RETURN_NONE;
391391
}
392392

393393
if (!PyArg_ParseTuple(args, "s", &c)) {
@@ -434,8 +434,7 @@ stdprinter_isatty(PyStdPrinter_Object *self)
434434
{
435435
long res;
436436
if (self->fd < 0) {
437-
Py_INCREF(Py_False);
438-
return Py_False;
437+
Py_RETURN_FALSE;
439438
}
440439

441440
Py_BEGIN_ALLOW_THREADS

0 commit comments

Comments
 (0)