[pypy-commit] lang-smalltalk default: refactored the special nil hack to have its own closure (function extract)

lwassermann noreply at buildbot.pypy.org
Tue Apr 16 16:25:43 CEST 2013


Author: Lars Wassermann <lars.wassermann at gmail.com>
Branch: 
Changeset: r285:90f0ca3c4b91
Date: 2013-04-16 16:17 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/90f0ca3c4b91/

Log:	refactored the special nil hack to have its own closure (function
	extract)

diff --git a/spyvm/objspace.py b/spyvm/objspace.py
--- a/spyvm/objspace.py
+++ b/spyvm/objspace.py
@@ -135,9 +135,13 @@
         # Very special nil hack: in order to allow W_PointersObject's to
         # initialize their fields to nil, we have to create it in the model
         # package, and then patch up its fields here:
-        w_nil = self.w_nil = model.w_nil
-        w_nil.space = self
-        w_nil.s_class = self.classtable['w_UndefinedObject'].as_class_get_penumbra(self)
+        def patch_nil(w_nil):
+            from spyvm.fieldtypes import nilTyper
+            w_nil.space = self
+            w_nil.fieldtypes = nilTyper
+            w_nil.s_class = self.classtable['w_UndefinedObject'].as_class_get_penumbra(self)
+            return w_nil
+        w_nil = self.w_nil = patch_nil(model.w_nil)
 
         w_true = self.classtable['w_True'].as_class_get_shadow(self).new()
         self.w_true = w_true


More information about the pypy-commit mailing list