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

Skip to content

Commit 4f169a7

Browse files
Issue #17147. Mention BytesIO in SpooledTemporaryFile documentation.
1 parent 01ad622 commit 4f169a7

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
@@ -83,9 +83,11 @@ The module defines the following user-callable items:
8383
causes the file to roll over to an on-disk file regardless of its size.
8484

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

9092

9193
.. function:: TemporaryDirectory(suffix='', prefix='tmp', dir=None)

Lib/tempfile.py

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

481481
class SpooledTemporaryFile:
482-
"""Temporary file wrapper, specialized to switch from
483-
StringIO to a real file when it exceeds a certain size or
482+
"""Temporary file wrapper, specialized to switch from BytesIO
483+
or StringIO to a real file when it exceeds a certain size or
484484
when a fileno is needed.
485485
"""
486486
_rolled = False

0 commit comments

Comments
 (0)