Skip to content

Commit d8fa40b

Browse files
gh-132551: add missing critical sections on BytesIO methods (#137073)
1 parent e93c30d commit d8fa40b

File tree

2 files changed

+46
-11
lines changed

2 files changed

+46
-11
lines changed

Modules/_io/bytesio.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,56 +270,60 @@ bytesio_get_closed(PyObject *op, void *Py_UNUSED(closure))
270270
}
271271

272272
/*[clinic input]
273+
@critical_section
273274
_io.BytesIO.readable
274275
275276
Returns True if the IO object can be read.
276277
[clinic start generated code]*/
277278

278279
static PyObject *
279280
_io_BytesIO_readable_impl(bytesio *self)
280-
/*[clinic end generated code: output=4e93822ad5b62263 input=96c5d0cccfb29f5c]*/
281+
/*[clinic end generated code: output=4e93822ad5b62263 input=ab7816facef48bfd]*/
281282
{
282283
CHECK_CLOSED(self);
283284
Py_RETURN_TRUE;
284285
}
285286

286287
/*[clinic input]
288+
@critical_section
287289
_io.BytesIO.writable
288290
289291
Returns True if the IO object can be written.
290292
[clinic start generated code]*/
291293

292294
static PyObject *
293295
_io_BytesIO_writable_impl(bytesio *self)
294-
/*[clinic end generated code: output=64ff6a254b1150b8 input=700eed808277560a]*/
296+
/*[clinic end generated code: output=64ff6a254b1150b8 input=4f35d49d26dab024]*/
295297
{
296298
CHECK_CLOSED(self);
297299
Py_RETURN_TRUE;
298300
}
299301

300302
/*[clinic input]
303+
@critical_section
301304
_io.BytesIO.seekable
302305
303306
Returns True if the IO object can be seeked.
304307
[clinic start generated code]*/
305308

306309
static PyObject *
307310
_io_BytesIO_seekable_impl(bytesio *self)
308-
/*[clinic end generated code: output=6b417f46dcc09b56 input=9421f65627a344dd]*/
311+
/*[clinic end generated code: output=6b417f46dcc09b56 input=9cc78d15aa1deaa3]*/
309312
{
310313
CHECK_CLOSED(self);
311314
Py_RETURN_TRUE;
312315
}
313316

314317
/*[clinic input]
318+
@critical_section
315319
_io.BytesIO.flush
316320
317321
Does nothing.
318322
[clinic start generated code]*/
319323

320324
static PyObject *
321325
_io_BytesIO_flush_impl(bytesio *self)
322-
/*[clinic end generated code: output=187e3d781ca134a0 input=561ea490be4581a7]*/
326+
/*[clinic end generated code: output=187e3d781ca134a0 input=c60842743910b381]*/
323327
{
324328
CHECK_CLOSED(self);
325329
Py_RETURN_NONE;
@@ -385,6 +389,7 @@ _io_BytesIO_getvalue_impl(bytesio *self)
385389
}
386390

387391
/*[clinic input]
392+
@critical_section
388393
_io.BytesIO.isatty
389394
390395
Always returns False.
@@ -394,7 +399,7 @@ BytesIO objects are not connected to a TTY-like device.
394399

395400
static PyObject *
396401
_io_BytesIO_isatty_impl(bytesio *self)
397-
/*[clinic end generated code: output=df67712e669f6c8f input=6f97f0985d13f827]*/
402+
/*[clinic end generated code: output=df67712e669f6c8f input=50487b74dc5ae8a9]*/
398403
{
399404
CHECK_CLOSED(self);
400405
Py_RETURN_FALSE;

Modules/_io/clinic/bytesio.c.h

Lines changed: 36 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)