[pypy-commit] lang-smalltalk default: (tfel, lwassermann) compare to None with is

timfel noreply at buildbot.pypy.org
Thu Mar 7 11:51:41 CET 2013


Author: Tim Felgentreff <timfelgentreff at gmail.com>
Branch: 
Changeset: r129:4a288f53c7fc
Date: 2013-03-07 11:01 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/4a288f53c7fc/

Log:	(tfel, lwassermann) compare to None with is

diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -124,7 +124,7 @@
             except Return, nlr:
                 s_new_frame = nlr.s_target_context
                 nlr.s_target_context.push(nlr.value)
-            if s_new_frame == None:
+            if s_new_frame is None:
                 # which means that we tried to call a primitive method
                 return s_frame.pop()
             else:
diff --git a/spyvm/squeakimage.py b/spyvm/squeakimage.py
--- a/spyvm/squeakimage.py
+++ b/spyvm/squeakimage.py
@@ -44,11 +44,17 @@
 
 class Stream(object):
     """ Simple input stream """
-    def __init__(self, inputfile):
-        try:
-            self.data = inputfile.read()
-        finally:
-            inputfile.close()
+    def __init__(self, inputfile=None, data=None):
+        if inputfile is None and data is None:
+            raise RuntimeError("need to supply either inputfile or data")
+
+        if inputfile:
+            try:
+                self.data = inputfile.read()
+            finally:
+                inputfile.close()
+        else:
+            self.data = data
         self.reset()
 
     def peek(self):
@@ -360,7 +366,7 @@
 
     def find_asSymbol(self, space, reader):
         w_dnu = self.special(constants.SO_DOES_NOT_UNDERSTAND)
-        assert w_dnu.as_string() == "doesNotUnderstand:"
+        # assert w_dnu.as_string() == "doesNotUnderstand:"
         w_Symbol = w_dnu.getclass(space)
         w_obj = None
         # bit annoying that we have to hunt through the image :-(


More information about the pypy-commit mailing list