From: Guido van Rossum Date: Tue, 18 Sep 2001 13:33:01 +0000 (+0000) Subject: softspace(): be prepared to catch AttributeError as well as TypeError X-Git-Tag: v2.2.1c1~1755 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=555d12f986bbf422a98e9083fae266f5ec3550a7;p=python softspace(): be prepared to catch AttributeError as well as TypeError upon attempted attribute assignment. Caught by MWH, SF bug #462522. --- diff --git a/Lib/code.py b/Lib/code.py index e2d506524d..ad42a9b1e6 100644 --- a/Lib/code.py +++ b/Lib/code.py @@ -20,7 +20,8 @@ def softspace(file, newvalue): pass try: file.softspace = newvalue - except TypeError: # "attribute-less object" or "read-only attributes" + except (AttributeError, TypeError): + # "attribute-less object" or "read-only attributes" pass return oldvalue