[pypy-svn] r46471 - in pypy/dist/pypy: annotation rpython

arigo at codespeak.net arigo at codespeak.net
Tue Sep 11 15:42:51 CEST 2007


Author: arigo
Date: Tue Sep 11 15:42:51 2007
New Revision: 46471

Modified:
   pypy/dist/pypy/annotation/bookkeeper.py
   pypy/dist/pypy/annotation/model.py
   pypy/dist/pypy/rpython/rweakref.py
Log:
Vague attempt at Python 2.3 compatibility.


Modified: pypy/dist/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/dist/pypy/annotation/bookkeeper.py	(original)
+++ pypy/dist/pypy/annotation/bookkeeper.py	Tue Sep 11 15:42:51 2007
@@ -389,7 +389,7 @@
                     dictdef.generalize_key(self.immutablevalue(ek, False))
                     dictdef.generalize_value(self.immutablevalue(ev, False))
                 result = SomeDict(dictdef)
-        elif tp is weakref.ref:
+        elif tp is weakref.ReferenceType:
             x1 = x()
             if x1 is None:
                 result = SomeDeadWeakRef()

Modified: pypy/dist/pypy/annotation/model.py
==============================================================================
--- pypy/dist/pypy/annotation/model.py	(original)
+++ pypy/dist/pypy/annotation/model.py	Tue Sep 11 15:42:51 2007
@@ -495,7 +495,7 @@
 # weakrefs
 
 class SomeWeakRef(SomeObject):
-    knowntype = weakref.ref
+    knowntype = weakref.ReferenceType
     immutable = True
     def __init__(self, classdef):
         self.classdef = classdef
@@ -504,7 +504,7 @@
         return False
 
 class SomeDeadWeakRef(SomeObject):
-    knowntype = weakref.ref
+    knowntype = weakref.ReferenceType
     immutable = True
 
     def can_be_none(self):

Modified: pypy/dist/pypy/rpython/rweakref.py
==============================================================================
--- pypy/dist/pypy/rpython/rweakref.py	(original)
+++ pypy/dist/pypy/rpython/rweakref.py	Tue Sep 11 15:42:51 2007
@@ -38,7 +38,7 @@
         return hop.genop('weakref_deref', [v_wref], resulttype=hop.r_result)
 
     def convert_const(self, value):
-        assert isinstance(value, weakref.ref)
+        assert isinstance(value, weakref.ReferenceType)
         instance = value()
         bk = self.rtyper.annotator.bookkeeper
         # obscure!  if the annotator hasn't seen this object before,



More information about the Pypy-commit mailing list