Skip to content

Commit 23a6726

Browse files
Issue #17147. Mention BytesIO in SpooledTemporaryFile documentation.
2 parents 8135de8 + 4f169a7 commit 23a6726

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

Doc/library/tempfile.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ The module defines the following user-callable items:
8282
causes the file to roll over to an on-disk file regardless of its size.
8383

8484
The returned object is a file-like object whose :attr:`_file` attribute
85-
is either a :class:`StringIO` object or a true file object, depending on
86-
whether :func:`rollover` has been called. This file-like object can be
87-
used in a :keyword:`with` statement, just like a normal file.
85+
is either a :class:`BytesIO` or :class:`StringIO` object (depending on
86+
whether specifies binary or text *mode* was specified) or a true file
87+
object, depending on whether :func:`rollover` has been called. This
88+
file-like object can be used in a :keyword:`with` statement, just like
89+
a normal file.
8890

8991
.. versionchanged:: 3.3
9092
the truncate method now accepts a ``size`` argument.

Lib/tempfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,8 @@ def TemporaryFile(mode='w+b', buffering=-1, encoding=None,
470470
raise
471471

472472
class SpooledTemporaryFile:
473-
"""Temporary file wrapper, specialized to switch from
474-
StringIO to a real file when it exceeds a certain size or
473+
"""Temporary file wrapper, specialized to switch from BytesIO
474+
or StringIO to a real file when it exceeds a certain size or
475475
when a fileno is needed.
476476
"""
477477
_rolled = False

0 commit comments

Comments
 (0)