Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9ea2d55

Browse files
Issue #17147. Mention BytesIO in SpooledTemporaryFile documentation.
2 parents 7611d9a + 19a5214 commit 9ea2d55

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 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
@@ -472,8 +472,8 @@ def TemporaryFile(mode='w+b', buffering=-1, encoding=None,
472472
raise
473473

474474
class SpooledTemporaryFile:
475-
"""Temporary file wrapper, specialized to switch from
476-
StringIO to a real file when it exceeds a certain size or
475+
"""Temporary file wrapper, specialized to switch from BytesIO
476+
or StringIO to a real file when it exceeds a certain size or
477477
when a fileno is needed.
478478
"""
479479
_rolled = False

0 commit comments

Comments
 (0)