]> granicus.if.org Git - python/commitdiff
softspace(): be prepared to catch AttributeError as well as TypeError
authorGuido van Rossum <guido@python.org>
Tue, 18 Sep 2001 13:33:01 +0000 (13:33 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 18 Sep 2001 13:33:01 +0000 (13:33 +0000)
upon attempted attribute assignment.  Caught by MWH, SF bug #462522.

Lib/code.py

index e2d506524d3ab250c84d967aee38eccea59b334f..ad42a9b1e6e184f3a22e59d6f9c904d86c7d24cd 100644 (file)
@@ -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