[pypy-commit] lang-smalltalk default: fixed a typo with _attr_ -> _attrs_ and subsequent annotator errors

lwassermann noreply at buildbot.pypy.org
Mon Jul 15 20:27:57 CEST 2013


Author: Lars Wassermann <lars.wassermann at gmail.com>
Branch: 
Changeset: r497:0a1371c9a90f
Date: 2013-07-15 20:26 +0200
http://bitbucket.org/pypy/lang-smalltalk/changeset/0a1371c9a90f/

Log:	fixed a typo with _attr_ -> _attrs_ and subsequent annotator errors

diff --git a/spyvm/error.py b/spyvm/error.py
--- a/spyvm/error.py
+++ b/spyvm/error.py
@@ -27,6 +27,7 @@
 	pass
 
 class Exit(Exception):
+    _attrs_ = ["msg"]
     def __init__(self, msg):
         self.msg = msg
 
diff --git a/spyvm/interpreter.py b/spyvm/interpreter.py
--- a/spyvm/interpreter.py
+++ b/spyvm/interpreter.py
@@ -195,19 +195,23 @@
         return symbol * (self.max_stack_depth - self.remaining_stack_depth)
 
 class ReturnFromTopLevel(Exception):
+    _attrs_ = ["object"]
     def __init__(self, object):
         self.object = object
 
 class StackOverflow(Exception):
+    _attrs_ = ["s_context"]
     def __init__(self, s_top_context):
         self.s_context = s_top_context
 
 class Return(Exception):
+    _attrs_ = ["value", "s_target_context"]
     def __init__(self, object, s_context):
         self.value = object
         self.s_target_context = s_context
 
 class ProcessSwitch(Exception):
+    _attrs_ = ["s_new_context"]
     def __init__(self, s_context):
         self.s_new_context = s_context
 
diff --git a/spyvm/interpreter_proxy.py b/spyvm/interpreter_proxy.py
--- a/spyvm/interpreter_proxy.py
+++ b/spyvm/interpreter_proxy.py
@@ -51,8 +51,9 @@
         def wrapped(*c_arguments):
             assert len_unwrap_spec == len(c_arguments)
             args = ()
-            if IProxy.interp.trace_proxy:
+            if IProxy.trace_proxy:
                 print 'Called InterpreterProxy >> %s' % func.func_name,
+            assert IProxy.s_frame is not None and IProxy.space is not None and IProxy.interp is not None
             try:
                 for i, spec in unrolling_unwrap_spec:
                     c_arg = c_arguments[i]
@@ -63,7 +64,7 @@
                     else:
                         args += (c_arg, )
                 result = func(*args)
-                if IProxy.interp.trace_proxy:
+                if IProxy.trace_proxy:
                     print '\t-> %s' % result
                 if result_type is oop:
                     assert isinstance(result, model.W_Object)
@@ -990,6 +991,7 @@
     def __init__(self):
         self.vm_proxy = lltype.nullptr(VMPtr.TO)
         self.vm_initialized = False
+        self.space = None
         self._next_oop = 0
         self.oop_map = {}
         self.object_map = {}
@@ -1003,6 +1005,7 @@
         self.argcount = 0
         self.s_method = None
         self.fail_reason = 0
+        self.trace_proxy = False
 
     def call(self, signature, interp, s_frame, argcount, s_method):
         self.initialize_from_call(signature, interp, s_frame, argcount, s_method)
@@ -1040,6 +1043,7 @@
         self.argcount = argcount
         self.s_method = s_method
         self.space = interp.space
+        self.trace_proxy = interp.trace_proxy
         # ensure that space.w_nil gets the first possible oop
         self.object_to_oop(self.space.w_nil)
 
diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -1074,6 +1074,8 @@
     """
 
     _immutable_fields_ = ["_shadow?"]
+    _attrs_ = ["bytes", "_likely_methodname", "header", "argsize", "primitive", 
+                "literals", "tempsize", "literalsize", "islarge", "_shadow"]
 ### Extension from Squeak 3.9 doc, which we do not implement:
 ###        trailer (variable)
 ###    The trailer has two variant formats.  In the first variant, the last
diff --git a/spyvm/shadow.py b/spyvm/shadow.py
--- a/spyvm/shadow.py
+++ b/spyvm/shadow.py
@@ -17,7 +17,7 @@
     """A shadow is an optional extra bit of information that
     can be attached at run-time to any Smalltalk object.
     """
-    _attr_ = ['_w_self']
+    _attrs_ = ['_w_self', 'space']
 
     def __init__(self, space, w_self):
         self.space = space
@@ -37,7 +37,7 @@
 
 class AbstractCachingShadow(AbstractShadow):
     _immutable_fields_ = ['version?']
-    _attr_ = []
+    _attrs_ = ['version']
 
     def __init__(self, space, w_self):
         AbstractShadow.__init__(self, space, w_self)
@@ -85,7 +85,7 @@
     (i.e. used as the class of another Smalltalk object).
     """
 
-    _attr_ = ["name", "_instance_size", "instance_varsized", "instance_kind",
+    _attrs_ = ["name", "_instance_size", "instance_varsized", "instance_kind",
                 "_s_methoddict", "_s_superclass", "subclass_s"]
 
     def __init__(self, space, w_self):
@@ -345,7 +345,7 @@
 class MethodDictionaryShadow(AbstractShadow):
 
     _immutable_fields_ = ['invalid?', 's_class']
-    _attr_ = ['methoddict']
+    _attrs_ = ['methoddict', 'invalid', 's_class']
 
     def __init__(self, space, w_self):
         self.invalid = True
@@ -398,7 +398,7 @@
 
 
 class AbstractRedirectingShadow(AbstractShadow):
-    _attr_ = ['_w_self_size']
+    _attrs_ = ['_w_self_size']
 
     def __init__(self, space, w_self):
         AbstractShadow.__init__(self, space, w_self)
@@ -440,7 +440,7 @@
 class ContextPartShadow(AbstractRedirectingShadow):
 
     __metaclass__ = extendabletype
-    _attr_ = ['_s_sender', '_pc', '_temps_and_stack',
+    _attrs_ = ['_s_sender', '_pc', '_temps_and_stack',
             '_stack_ptr', 'instances_w']
 
     _virtualizable2_ = [
@@ -734,7 +734,7 @@
 
 
 class BlockContextShadow(ContextPartShadow):
-    _attr_ = ['_w_home', '_initialip', '_eargc']
+    _attrs_ = ['_w_home', '_initialip', '_eargc']
 
     @staticmethod
     def make_context(space, w_home, s_sender, argcnt, initialip):
@@ -840,7 +840,7 @@
         )
 
 class MethodContextShadow(ContextPartShadow):
-    _attr_ = ['w_closure_or_nil', '_w_receiver', '_w_method']
+    _attrs_ = ['w_closure_or_nil', '_w_receiver', '_w_method']
 
     def __init__(self, space, w_self):
         self.w_closure_or_nil = space.w_nil
@@ -1005,11 +1005,11 @@
         return '%s%s' % (block, self.w_method().get_identifier_string())
 
 class CompiledMethodShadow(object):
-    _attr_ = ["_w_self", "bytecode",
-              "literals[*]", "bytecodeoffset",
-              "literalsize", "tempsize", "primitive",
+    _attrs_ = ["_w_self", "bytecode",
+              "literals", "bytecodeoffset",
+              "literalsize", "_tempsize", "_primitive",
               "argsize", "islarge",
-              "w_compiledin"]
+              "w_compiledin", "version"]
     _immutable_fields_ = ["version?", "_w_self"]
 
     def __init__(self, w_compiledmethod):
@@ -1038,13 +1038,13 @@
         w_compiledmethod = self._w_self
         self.version = Version()
         self.bytecode = "".join(w_compiledmethod.bytes)
-        self.literals = w_compiledmethod.literals
         self.bytecodeoffset = w_compiledmethod.bytecodeoffset()
         self.literalsize = w_compiledmethod.getliteralsize()
         self._tempsize = w_compiledmethod.gettempsize()
         self._primitive = w_compiledmethod.primitive
         self.argsize = w_compiledmethod.argsize
         self.islarge = w_compiledmethod.islarge
+        self.literals = w_compiledmethod.literals
 
         self.w_compiledin = None
         if self.literals:
@@ -1098,7 +1098,7 @@
 
 
 class ObserveeShadow(AbstractShadow):
-    _attr_ = ['dependent']
+    _attrs_ = ['dependent']
     def __init__(self, space, w_self):
         AbstractShadow.__init__(self, space, w_self)
         self.dependent = None


More information about the pypy-commit mailing list