[pypy-commit] pypy py3k: catch the correct exception type for both pypy and cpython

antocuni noreply at buildbot.pypy.org
Wed Oct 24 19:18:56 CEST 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r58400:0278546b4427
Date: 2012-10-24 19:18 +0200
http://bitbucket.org/pypy/pypy/changeset/0278546b4427/

Log:	catch the correct exception type for both pypy and cpython

diff --git a/pypy/module/__builtin__/test/test_descriptor.py b/pypy/module/__builtin__/test/test_descriptor.py
--- a/pypy/module/__builtin__/test/test_descriptor.py
+++ b/pypy/module/__builtin__/test/test_descriptor.py
@@ -323,7 +323,9 @@
         for attr in "__doc__", "fget", "fset", "fdel":
             try:
                 setattr(raw, attr, 42)
-            except AttributeError as msg:
+            # it raises TypeError on pypy, AttributeError on CPython: we catch
+            # both so that it runs also with -A
+            except (TypeError, AttributeError) as msg:
                 if str(msg).find('readonly') < 0:
                     raise Exception("when setting readonly attr %r on a "
                                     "property, got unexpected TypeError "


More information about the pypy-commit mailing list