]> granicus.if.org Git - python/commitdiff
Fix test_wsgiref that used StringIO and a BufferedReader rather than
authorNeal Norwitz <nnorwitz@gmail.com>
Sat, 11 Aug 2007 18:37:05 +0000 (18:37 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sat, 11 Aug 2007 18:37:05 +0000 (18:37 +0000)
real files.  This code assumed that fileno() would succeed which wasn't
the case.

Lib/io.py

index b24a21cf1d409c5145f9cf0fa1cd0cca422a2d5e..2f2d3c5997f8aea4dede6ed1ddc254fe8abbd69b 100644 (file)
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -34,6 +34,7 @@ import os
 import sys
 import codecs
 import _fileio
+import io
 import warnings
 
 # XXX Shouldn't we use st_blksize whenever we can?
@@ -973,7 +974,7 @@ class TextIOWrapper(TextIOBase):
         if encoding is None:
             try:
                 encoding = os.device_encoding(buffer.fileno())
-            except AttributeError:
+            except (AttributeError, io.UnsupportedOperation):
                 pass
             if encoding is None:
                 try: