From: Neal Norwitz Date: Sat, 11 Aug 2007 18:37:05 +0000 (+0000) Subject: Fix test_wsgiref that used StringIO and a BufferedReader rather than X-Git-Tag: v3.0a1~444 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e50a9f7cc68aefdf94ad02bc3e62fee2f447208;p=python Fix test_wsgiref that used StringIO and a BufferedReader rather than real files. This code assumed that fileno() would succeed which wasn't the case. --- diff --git a/Lib/io.py b/Lib/io.py index b24a21cf1d..2f2d3c5997 100644 --- 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: