From 4f169a7a4df0cfb4da6c7bab40a17dddc083cf2a Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 9 Feb 2013 11:46:42 +0200 Subject: Issue #17147. Mention BytesIO in SpooledTemporaryFile documentation. --- Doc/library/tempfile.rst | 8 +++++--- Lib/tempfile.py | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst index c143b88..b68a412 100644 --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -83,9 +83,11 @@ The module defines the following user-callable items: causes the file to roll over to an on-disk file regardless of its size. The returned object is a file-like object whose :attr:`_file` attribute - is either a :class:`StringIO` object or a true file object, depending on - whether :func:`rollover` has been called. This file-like object can be - used in a :keyword:`with` statement, just like a normal file. + is either a :class:`BytesIO` or :class:`StringIO` object (depending on + whether specifies binary or text *mode* was specified) or a true file + object, depending on whether :func:`rollover` has been called. This + file-like object can be used in a :keyword:`with` statement, just like + a normal file. .. function:: TemporaryDirectory(suffix='', prefix='tmp', dir=None) diff --git a/Lib/tempfile.py b/Lib/tempfile.py index b8fc18c..86300b6 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -479,8 +479,8 @@ else: raise class SpooledTemporaryFile: - """Temporary file wrapper, specialized to switch from - StringIO to a real file when it exceeds a certain size or + """Temporary file wrapper, specialized to switch from BytesIO + or StringIO to a real file when it exceeds a certain size or when a fileno is needed. """ _rolled = False -- cgit v0.12 From 4b109cb4a8dd2ad9d55913b682c6234f7bcd874e Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 9 Feb 2013 11:51:21 +0200 Subject: Minor fix of previous commit. --- Doc/library/tempfile.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst index b68a412..a8323a5 100644 --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -84,7 +84,7 @@ The module defines the following user-callable items: The returned object is a file-like object whose :attr:`_file` attribute is either a :class:`BytesIO` or :class:`StringIO` object (depending on - whether specifies binary or text *mode* was specified) or a true file + whether binary or text *mode* was specified) or a true file object, depending on whether :func:`rollover` has been called. This file-like object can be used in a :keyword:`with` statement, just like a normal file. -- cgit v0.12