[pypy-svn] r20494 - pypy/branch/somepbc-refactoring/pypy/annotation
mwh at codespeak.net
mwh at codespeak.net
Thu Dec 1 14:58:57 CET 2005
Author: mwh
Date: Thu Dec 1 14:58:56 2005
New Revision: 20494
Modified:
pypy/branch/somepbc-refactoring/pypy/annotation/bookkeeper.py
Log:
Create InstanceSources for instances that are only seen as the im_self
of a bound method. Fixes the new test in test_annrpython.py.
Modified: pypy/branch/somepbc-refactoring/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/annotation/bookkeeper.py (original)
+++ pypy/branch/somepbc-refactoring/pypy/annotation/bookkeeper.py Thu Dec 1 14:58:56 2005
@@ -377,15 +377,8 @@
if frozen:
result = SomePBC([self.getdesc(x)])
else:
- clsdef = self.getuniqueclassdef(x.__class__)
- if x not in self.seen_mutable: # avoid circular reflowing,
- # see for example test_circular_mutable_getattr
- self.seen_mutable[x] = True
- self.event('mutable', x)
- source = InstanceSource(self, x)
- for attr in x.__dict__:
- clsdef.add_source_for_attribute(attr, source) # can trigger reflowing
- result = SomeInstance(clsdef)
+ self.see_mutable(x)
+ result = SomeInstance(self.getuniqueclassdef(x.__class__))
elif x is None:
return s_None
else:
@@ -420,6 +413,7 @@
self.getdesc(pyobj.im_self)) # frozendesc
else: # regular method
origincls, name = origin_of_meth(pyobj)
+ self.see_mutable(pyobj.im_self)
result = self.getmethoddesc(
self.getdesc(pyobj.im_func), # funcdesc
self.getuniqueclassdef(origincls), # originclassdef
@@ -449,6 +443,16 @@
self.methoddescs[key] = result
return result
+ def see_mutable(self, x):
+ if x in self.seen_mutable:
+ return
+ clsdef = self.getuniqueclassdef(x.__class__)
+ self.seen_mutable[x] = True
+ self.event('mutable', x)
+ source = InstanceSource(self, x)
+ for attr in x.__dict__:
+ clsdef.add_source_for_attribute(attr, source) # can trigger reflowing
+
def valueoftype(self, t):
"""The most precise SomeValue instance that contains all
objects of type t."""
More information about the Pypy-commit
mailing list