mirror of
https://github.com/python/cpython.git
synced 2026-01-04 14:32:21 +00:00
gh-132551: add missing critical sections on BytesIO methods (#137073)
This commit is contained in:
parent
e93c30d466
commit
d8fa40b08d
2 changed files with 46 additions and 11 deletions
|
|
@ -270,6 +270,7 @@ bytesio_get_closed(PyObject *op, void *Py_UNUSED(closure))
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@critical_section
|
||||
_io.BytesIO.readable
|
||||
|
||||
Returns True if the IO object can be read.
|
||||
|
|
@ -277,13 +278,14 @@ Returns True if the IO object can be read.
|
|||
|
||||
static PyObject *
|
||||
_io_BytesIO_readable_impl(bytesio *self)
|
||||
/*[clinic end generated code: output=4e93822ad5b62263 input=96c5d0cccfb29f5c]*/
|
||||
/*[clinic end generated code: output=4e93822ad5b62263 input=ab7816facef48bfd]*/
|
||||
{
|
||||
CHECK_CLOSED(self);
|
||||
Py_RETURN_TRUE;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
@critical_section
|
||||
_io.BytesIO.writable
|
||||
|
||||
Returns True if the IO object can be written.
|
||||
|
|
@ -291,13 +293,14 @@ Returns True if the IO object can be written.
|
|||
|
||||
static PyObject *
|
||||
_io_BytesIO_writable_impl(bytesio *self)
|
||||
/*[clinic end generated code: output=64ff6a254b1150b8 input=700eed808277560a]*/
|
||||
/*[clinic end generated code: output=64ff6a254b1150b8 input=4f35d49d26dab024]*/
|
||||
{
|
||||
CHECK_CLOSED(self);
|
||||
Py_RETURN_TRUE;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
@critical_section
|
||||
_io.BytesIO.seekable
|
||||
|
||||
Returns True if the IO object can be seeked.
|
||||
|
|
@ -305,13 +308,14 @@ Returns True if the IO object can be seeked.
|
|||
|
||||
static PyObject *
|
||||
_io_BytesIO_seekable_impl(bytesio *self)
|
||||
/*[clinic end generated code: output=6b417f46dcc09b56 input=9421f65627a344dd]*/
|
||||
/*[clinic end generated code: output=6b417f46dcc09b56 input=9cc78d15aa1deaa3]*/
|
||||
{
|
||||
CHECK_CLOSED(self);
|
||||
Py_RETURN_TRUE;
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
@critical_section
|
||||
_io.BytesIO.flush
|
||||
|
||||
Does nothing.
|
||||
|
|
@ -319,7 +323,7 @@ Does nothing.
|
|||
|
||||
static PyObject *
|
||||
_io_BytesIO_flush_impl(bytesio *self)
|
||||
/*[clinic end generated code: output=187e3d781ca134a0 input=561ea490be4581a7]*/
|
||||
/*[clinic end generated code: output=187e3d781ca134a0 input=c60842743910b381]*/
|
||||
{
|
||||
CHECK_CLOSED(self);
|
||||
Py_RETURN_NONE;
|
||||
|
|
@ -385,6 +389,7 @@ _io_BytesIO_getvalue_impl(bytesio *self)
|
|||
}
|
||||
|
||||
/*[clinic input]
|
||||
@critical_section
|
||||
_io.BytesIO.isatty
|
||||
|
||||
Always returns False.
|
||||
|
|
@ -394,7 +399,7 @@ BytesIO objects are not connected to a TTY-like device.
|
|||
|
||||
static PyObject *
|
||||
_io_BytesIO_isatty_impl(bytesio *self)
|
||||
/*[clinic end generated code: output=df67712e669f6c8f input=6f97f0985d13f827]*/
|
||||
/*[clinic end generated code: output=df67712e669f6c8f input=50487b74dc5ae8a9]*/
|
||||
{
|
||||
CHECK_CLOSED(self);
|
||||
Py_RETURN_FALSE;
|
||||
|
|
|
|||
42
Modules/_io/clinic/bytesio.c.h
generated
42
Modules/_io/clinic/bytesio.c.h
generated
|
|
@ -25,7 +25,13 @@ _io_BytesIO_readable_impl(bytesio *self);
|
|||
static PyObject *
|
||||
_io_BytesIO_readable(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return _io_BytesIO_readable_impl((bytesio *)self);
|
||||
PyObject *return_value = NULL;
|
||||
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = _io_BytesIO_readable_impl((bytesio *)self);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(_io_BytesIO_writable__doc__,
|
||||
|
|
@ -43,7 +49,13 @@ _io_BytesIO_writable_impl(bytesio *self);
|
|||
static PyObject *
|
||||
_io_BytesIO_writable(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return _io_BytesIO_writable_impl((bytesio *)self);
|
||||
PyObject *return_value = NULL;
|
||||
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = _io_BytesIO_writable_impl((bytesio *)self);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(_io_BytesIO_seekable__doc__,
|
||||
|
|
@ -61,7 +73,13 @@ _io_BytesIO_seekable_impl(bytesio *self);
|
|||
static PyObject *
|
||||
_io_BytesIO_seekable(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return _io_BytesIO_seekable_impl((bytesio *)self);
|
||||
PyObject *return_value = NULL;
|
||||
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = _io_BytesIO_seekable_impl((bytesio *)self);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(_io_BytesIO_flush__doc__,
|
||||
|
|
@ -79,7 +97,13 @@ _io_BytesIO_flush_impl(bytesio *self);
|
|||
static PyObject *
|
||||
_io_BytesIO_flush(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return _io_BytesIO_flush_impl((bytesio *)self);
|
||||
PyObject *return_value = NULL;
|
||||
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = _io_BytesIO_flush_impl((bytesio *)self);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(_io_BytesIO_getbuffer__doc__,
|
||||
|
|
@ -152,7 +176,13 @@ _io_BytesIO_isatty_impl(bytesio *self);
|
|||
static PyObject *
|
||||
_io_BytesIO_isatty(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return _io_BytesIO_isatty_impl((bytesio *)self);
|
||||
PyObject *return_value = NULL;
|
||||
|
||||
Py_BEGIN_CRITICAL_SECTION(self);
|
||||
return_value = _io_BytesIO_isatty_impl((bytesio *)self);
|
||||
Py_END_CRITICAL_SECTION();
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(_io_BytesIO_tell__doc__,
|
||||
|
|
@ -607,4 +637,4 @@ skip_optional_pos:
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=580205daa01def2e input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=daa81dfdae5ccc57 input=a9049054013a1b77]*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue