[pypy-svn] r63063 - in pypy/trunk/pypy/translator: . test
pedronis at codespeak.net
pedronis at codespeak.net
Thu Mar 19 11:30:34 CET 2009
Author: pedronis
Date: Thu Mar 19 11:30:32 2009
New Revision: 63063
Modified:
pypy/trunk/pypy/translator/geninterplevel.py
pypy/trunk/pypy/translator/test/snippet.py
pypy/trunk/pypy/translator/test/test_geninterp.py
Log:
(iko, pedronis)
hopefully fix translation on 2.4
Modified: pypy/trunk/pypy/translator/geninterplevel.py
==============================================================================
--- pypy/trunk/pypy/translator/geninterplevel.py (original)
+++ pypy/trunk/pypy/translator/geninterplevel.py Thu Mar 19 11:30:32 2009
@@ -632,9 +632,10 @@
self.initcode.append1('%s = space.wrap(%s)' % (name, functionname))
return name
- def nameof_instancemethod(self, meth):
- if meth.im_func.func_globals is None:
- # built-in methods (bound or not) on top of PyPy
+ def nameof_instancemethod(self, meth):
+ if (not hasattr(meth.im_func, 'func_globals') or
+ meth.im_func.func_globals is None):
+ # built-in methods (bound or not) on top of PyPy or possibly 2.4
return self.nameof_builtin_method(meth)
if meth.im_self is None:
# no error checking here
Modified: pypy/trunk/pypy/translator/test/snippet.py
==============================================================================
--- pypy/trunk/pypy/translator/test/snippet.py (original)
+++ pypy/trunk/pypy/translator/test/snippet.py Thu Mar 19 11:30:32 2009
@@ -666,6 +666,17 @@
return 567
+class Exc(Exception):
+ def __init__(self, v):
+ Exception.__init__(self, v)
+
+def exception_subclass_sanity(x):
+ try:
+ raise Exc(x)
+ except Exception, e:
+ return e.args[0]
+
+
# --------------------(Currently) Non runnable Functions ---------------------
def _somebug1(n=int):
Modified: pypy/trunk/pypy/translator/test/test_geninterp.py
==============================================================================
--- pypy/trunk/pypy/translator/test/test_geninterp.py (original)
+++ pypy/trunk/pypy/translator/test/test_geninterp.py Thu Mar 19 11:30:32 2009
@@ -299,3 +299,8 @@
fn = self.build_interpfunc(snippet.t_attrerror)
result = fn(42)
assert result == 567
+
+ def test_Exception_subclass(self):
+ fn = self.build_interpfunc(snippet.exception_subclass_sanity)
+ result = fn(7)
+ assert result == 7
More information about the Pypy-commit
mailing list