[pypy-svn] r42100 - in pypy/dist/pypy: annotation rpython/test
arigo at codespeak.net
arigo at codespeak.net
Mon Apr 16 17:52:48 CEST 2007
Author: arigo
Date: Mon Apr 16 17:52:48 2007
New Revision: 42100
Modified:
pypy/dist/pypy/annotation/annrpython.py
pypy/dist/pypy/annotation/classdef.py
pypy/dist/pypy/annotation/description.py
pypy/dist/pypy/rpython/test/test_exception.py
Log:
Fixes for Python 2.5 (Exception => py.builtin.BaseException).
Modified: pypy/dist/pypy/annotation/annrpython.py
==============================================================================
--- pypy/dist/pypy/annotation/annrpython.py (original)
+++ pypy/dist/pypy/annotation/annrpython.py Mon Apr 16 17:52:48 2007
@@ -622,7 +622,7 @@
last_exc_value_var = link.last_exc_value # may be None for non-exception link
if isinstance(link.exitcase, (types.ClassType, type)) \
- and issubclass(link.exitcase, Exception):
+ and issubclass(link.exitcase, py.builtin.BaseException):
assert last_exception_var and last_exc_value_var
last_exc_value_object = self.bookkeeper.valueoftype(link.exitcase)
last_exception_object = annmodel.SomeObject()
Modified: pypy/dist/pypy/annotation/classdef.py
==============================================================================
--- pypy/dist/pypy/annotation/classdef.py (original)
+++ pypy/dist/pypy/annotation/classdef.py Mon Apr 16 17:52:48 2007
@@ -230,18 +230,8 @@
other1 = other
while other is not None and not self.issubclass(other):
other = other.basedef
- # special case for MI with Exception
- #if other is None and other1 is not None:
- # if issubclass(self.cls, Exception) and issubclass(other1.cls, Exception):
- # return self.bookkeeper.getclassdef(Exception)
return other
- #def superdef_containing(self, cls):
- # clsdef = self
- # while clsdef is not None and not issubclass(cls, clsdef.cls):
- # clsdef = clsdef.basedef
- # return clsdef
-
def getmro(self):
while self is not None:
yield self
Modified: pypy/dist/pypy/annotation/description.py
==============================================================================
--- pypy/dist/pypy/annotation/description.py (original)
+++ pypy/dist/pypy/annotation/description.py Mon Apr 16 17:52:48 2007
@@ -536,7 +536,8 @@
return s_instance
def is_exception_class(self):
- return self.pyobj is not None and issubclass(self.pyobj, Exception)
+ return self.pyobj is not None and issubclass(self.pyobj,
+ py.builtin.BaseException)
def is_builtin_exception_class(self):
if self.is_exception_class():
Modified: pypy/dist/pypy/rpython/test/test_exception.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_exception.py (original)
+++ pypy/dist/pypy/rpython/test/test_exception.py Mon Apr 16 17:52:48 2007
@@ -112,6 +112,17 @@
next_instr -= operr.a
py.test.raises(LLException, self.interpret, f, [10])
+ def test_catch_KeyboardInterrupt(self):
+ def g(n):
+ return n
+ def f(n):
+ try:
+ return g(n)
+ except KeyboardInterrupt:
+ return -1
+ res = self.interpret(f, [11])
+ assert res == 11
+
class TestLLtype(BaseTestException, LLRtypeMixin):
pass
More information about the pypy-svn
mailing list