[pypy-svn] r4330 - in pypy/trunk/src/pypy: annotation translator/test

arigo at codespeak.net arigo at codespeak.net
Sat May 8 19:23:09 CEST 2004


Author: arigo
Date: Sat May  8 19:23:09 2004
New Revision: 4330

Modified:
   pypy/trunk/src/pypy/annotation/unaryop.py
   pypy/trunk/src/pypy/translator/test/snippet.py
Log:
Bug found by Samuele, with a test and a fix.


Modified: pypy/trunk/src/pypy/annotation/unaryop.py
==============================================================================
--- pypy/trunk/src/pypy/annotation/unaryop.py	(original)
+++ pypy/trunk/src/pypy/annotation/unaryop.py	Sat May  8 19:23:09 2004
@@ -139,6 +139,11 @@
         #print 'methodcall:', met, arglist
         assert arglist is not None
         factory = getbookkeeper().getfactory(FuncCallFactory)
-        results = [factory.pycall(func, [SomeInstance(classdef)]+arglist)
-                   for func, classdef in met.meths.items()]
+        results = []
+        for func, classdef in met.meths.items():
+            # create s_self and record the creation in the factory
+            s_self = SomeInstance(classdef)
+            classdef.instancefactories[factory] = True
+            # call func(s_self, *arglist)
+            results.append(factory.pycall(func, [s_self]+arglist))
         return unionof(*results)

Modified: pypy/trunk/src/pypy/translator/test/snippet.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/snippet.py	(original)
+++ pypy/trunk/src/pypy/translator/test/snippet.py	Sat May  8 19:23:09 2004
@@ -330,6 +330,7 @@
         return D(), x
 class H(F):
     def m(self, y):
+        self.attr = 1
         return E(), y
 
 def methodcall1(cond):


More information about the Pypy-commit mailing list