[pypy-svn] r46571 - pypy/dist/pypy/translator/oosupport

antocuni at codespeak.net antocuni at codespeak.net
Fri Sep 14 12:01:00 CEST 2007


Author: antocuni
Date: Fri Sep 14 12:01:00 2007
New Revision: 46571

Modified:
   pypy/dist/pypy/translator/oosupport/constant.py
Log:
don't crash when rendering prebuilt null weakrefs



Modified: pypy/dist/pypy/translator/oosupport/constant.py
==============================================================================
--- pypy/dist/pypy/translator/oosupport/constant.py	(original)
+++ pypy/dist/pypy/translator/oosupport/constant.py	Fri Sep 14 12:01:00 2007
@@ -692,7 +692,11 @@
 
 class WeakRefConst(AbstractConst):
     def __init__(self, db, wref, count):
-        AbstractConst.__init__(self, db, wref.ll_deref(), count)
+        if wref:
+            value = wref.ll_deref()
+        else:
+            value = None
+        AbstractConst.__init__(self, db, value, count)
         self.name = 'WEAKREF__%d' % count
 
     def OOTYPE(self):
@@ -700,7 +704,7 @@
         return None
     
     def is_null(self):
-        return False
+        return self.value is None
 
     def record_dependencies(self):
         if self.value is not None:



More information about the Pypy-commit mailing list