[pypy-commit] pypy kill-someobject: fix flow tests
alex_gaynor
noreply at buildbot.pypy.org
Mon Oct 8 10:04:30 CEST 2012
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: kill-someobject
Changeset: r57878:3d1b217354aa
Date: 2012-10-08 10:04 +0200
http://bitbucket.org/pypy/pypy/changeset/3d1b217354aa/
Log: fix flow tests
diff --git a/pypy/objspace/flow/model.py b/pypy/objspace/flow/model.py
--- a/pypy/objspace/flow/model.py
+++ b/pypy/objspace/flow/model.py
@@ -1,6 +1,6 @@
# The model produced by the flowobjspace
# this is to be used by the translator mainly.
-#
+#
# the below object/attribute model evolved from
# a discussion in Berlin, 4th of october 2003
import py
@@ -19,7 +19,7 @@
Var/Const/SpaceOp 205 MB 325 MB
+ Link 189 MB 311 MB
+ Block 185 MB 304 MB
-
+
Dropping Variable.instances and using
just an instancenames dict brought
annotation down to 160 MB.
@@ -55,13 +55,19 @@
@property
def source(self):
+ if hasattr(self, "_source"):
+ return self._source
from pypy.tool.sourcetools import getsource
- func = self.func # can raise AttributeError
+ self.func # can raise AttributeError
src = getsource(self.func)
if src is None:
raise AttributeError('source not found')
return src
+ @source.setter
+ def source(self, value):
+ self._source = value
+
@property
def startline(self):
return self.func.func_code.co_firstlineno
diff --git a/pypy/objspace/flow/test/test_model.py b/pypy/objspace/flow/test/test_model.py
--- a/pypy/objspace/flow/test/test_model.py
+++ b/pypy/objspace/flow/test/test_model.py
@@ -57,7 +57,7 @@
assert graph.returnblock is pieces.headerblock.exits[0].target
assert graph.getargs() == [pieces.i]
assert [graph.getreturnvar()] == graph.returnblock.inputargs
- assert graph.getsource() == inspect.getsource(sample_function)
+ assert graph.source == inspect.getsource(sample_function)
def test_iterblocks():
assert list(graph.iterblocks()) == [pieces.startblock,
More information about the pypy-commit
mailing list