From: Stefan Behnel Date: Sat, 17 Jul 2010 14:35:09 +0000 (+0200) Subject: test fix for Py<2.5 X-Git-Tag: 0.13.beta0~12 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=117a5caf806aae2ee1219b87ea44ba338efaac46;p=cython.git test fix for Py<2.5 --- diff --git a/tests/run/withstat.pyx b/tests/run/withstat.pyx index ff6eb5ec..bea6437e 100644 --- a/tests/run/withstat.pyx +++ b/tests/run/withstat.pyx @@ -1,8 +1,15 @@ from __future__ import with_statement +import sys def typename(t): - return u"" % type(t).__name__ + name = type(t).__name__ + if sys.version_info < (2,5): + if name == 'classobj' and issubclass(t, MyException): + name = 'type' + elif name == 'instance' and isinstance(t, MyException): + name = 'MyException' + return u"" % name class MyException(Exception): pass