Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-90102: Remove isatty call during regular open #124922

Merged
merged 10 commits into from
Oct 8, 2024
Prev Previous commit
Next Next commit
WinConsoleIO add _isatty_openonly, simplify FileIO's
  • Loading branch information
cmaloney committed Oct 3, 2024
commit cba68bc7b6f87ae6cb695087baa7c73c5a369eb5
2 changes: 1 addition & 1 deletion Modules/_io/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@
this is subject to TOCTOU issues (the FD has been returned to user code
and arbitrary syscalls could have happened). */
static PyObject *
_io_FileIO_isatty_openonly(fileio *self, void *Py_UNUSED(ignored))
_io_FileIO_isatty_openonly(fileio *self)
{
if (self->stat_atopen != NULL && !S_ISCHR(self->stat_atopen->st_mode)) {
Py_RETURN_FALSE;
Expand All @@ -1236,7 +1236,7 @@
_IO_FILEIO_WRITABLE_METHODDEF
_IO_FILEIO_FILENO_METHODDEF
_IO_FILEIO_ISATTY_METHODDEF
{"_isatty_openonly", (PyCFunction)_io_FileIO_isatty_openonly, METH_NOARGS},

Check warning on line 1239 in Modules/_io/fileio.c

View workflow job for this annotation

GitHub Actions / Address sanitizer

cast between incompatible function types from ‘PyObject * (*)(fileio *)’ {aka ‘struct _object * (*)(fileio *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type]

Check warning on line 1239 in Modules/_io/fileio.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

cast between incompatible function types from ‘PyObject * (*)(fileio *)’ {aka ‘struct _object * (*)(fileio *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type]

Check warning on line 1239 in Modules/_io/fileio.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-22.04)

cast between incompatible function types from ‘PyObject * (*)(fileio *)’ {aka ‘struct _object * (*)(fileio *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type]

Check warning on line 1239 in Modules/_io/fileio.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-22.04)

cast between incompatible function types from ‘PyObject * (*)(fileio *)’ {aka ‘struct _object * (*)(fileio *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’} [-Wcast-function-type]
{"_dealloc_warn", (PyCFunction)fileio_dealloc_warn, METH_O, NULL},
{"__reduce__", _PyIOBase_cannot_pickle, METH_NOARGS},
{"__reduce_ex__", _PyIOBase_cannot_pickle, METH_O},
Expand Down
1 change: 1 addition & 0 deletions Modules/_io/winconsoleio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,7 @@ static PyMethodDef winconsoleio_methods[] = {
_IO__WINDOWSCONSOLEIO_WRITABLE_METHODDEF
_IO__WINDOWSCONSOLEIO_FILENO_METHODDEF
_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
{"_isatty_openonly", (PyCFunction)_io__WindowsConsoleIO_isatty, METH_NOARGS},
{NULL, NULL} /* sentinel */
};

Expand Down
Loading