[pypy-svn] r26898 - in pypy/dist/pypy: annotation rpython/test
arigo at codespeak.net
arigo at codespeak.net
Sat May 6 21:39:05 CEST 2006
Author: arigo
Date: Sat May 6 21:39:04 2006
New Revision: 26898
Modified:
pypy/dist/pypy/annotation/description.py
pypy/dist/pypy/rpython/test/test_rpbc.py
Log:
Test and fix for manipulating functions that are not actually called anywhere.
This used to work but was not directly tested, so I broke it.
Modified: pypy/dist/pypy/annotation/description.py
==============================================================================
--- pypy/dist/pypy/annotation/description.py (original)
+++ pypy/dist/pypy/annotation/description.py Sat May 6 21:39:04 2006
@@ -145,6 +145,11 @@
changed = changed or changed1
return changed
+ def queryattrfamily(self):
+ # no attributes supported by default;
+ # overriden in FrozenDesc and ClassDesc
+ return None
+
def bind_under(self, classdef, name):
return self
Modified: pypy/dist/pypy/rpython/test/test_rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rpbc.py (original)
+++ pypy/dist/pypy/rpython/test/test_rpbc.py Sat May 6 21:39:04 2006
@@ -1247,6 +1247,21 @@
res = interpret(f, [i])
assert res == f(i)
+ def test_function_as_frozen_pbc(self):
+ def f1(): pass
+ def f2(): pass
+ def choose(n):
+ if n == 1:
+ return f1
+ else:
+ return f2
+ def f(n):
+ return choose(n) is f1
+ res = interpret(f, [1], type_system=self.ts)
+ assert res == True
+ res = interpret(f, [2], type_system=self.ts)
+ assert res == False
+
def test_call_from_list():
# Don't test with ootype, since it doesn't support lists in a
More information about the Pypy-commit
mailing list