micropython

Change of rsvp.py

256:be363259339c
rsvp.py
     1.1 --- a/rsvp.py	Tue Jul 14 00:37:04 2009 +0200
     1.2 +++ b/rsvp.py	Sun Jul 19 22:17:23 2009 +0200
     1.3 @@ -127,7 +127,7 @@
     1.4          cls = self._get_class("__builtins__", "TypeError")
     1.5          self.type_error = cls.location
     1.6          self.type_error_instance = cls.instance_template_location
     1.7 -        cls = self.machine._get_class("__builtins__", "tuple")
     1.8 +        cls = self._get_class("__builtins__", "tuple")
     1.9          self.tuple_class = cls.location
    1.10          self.tuple_instance = cls.instance_template_location
    1.11  
    1.12 @@ -581,7 +581,7 @@
    1.13          self.status = data.attrcode is None # absent attrcode == class
    1.14  
    1.15      def CheckFrame(self):
    1.16 -        (nargs, ndefaults, has_star) = self.operand
    1.17 +        (nargs, ndefaults) = self.operand
    1.18  
    1.19          # The frame is actually installed as the locals.
    1.20          # Retrieve the context from the first local.
    1.21 @@ -589,14 +589,25 @@
    1.22          frame = self.local_sp_stack[-1]
    1.23          nlocals = len(self.frame_stack[frame:])
    1.24  
    1.25 -        # NOTE: Not testing (nlocals <= nargs or has_star) due to imprecise
    1.26 -        # NOTE: invocation frame removal (after frame adjustment).
    1.27 -
    1.28          if not ((nargs - ndefaults) <= nlocals):
    1.29              raise Exception, "CheckFrame %r (%r <= %r <= %r)" % (self.operand, nargs - ndefaults, nlocals, nargs)
    1.30              self.exception = self._MakeObject(2, self.type_error_instance)
    1.31              return self.RaiseException()
    1.32  
    1.33 +    def CheckExtra(self):
    1.34 +        nargs = self.operand
    1.35 +
    1.36 +        # The frame is actually installed as the locals.
    1.37 +        # Retrieve the context from the first local.
    1.38 +
    1.39 +        frame = self.local_sp_stack[-1]
    1.40 +        nlocals = len(self.frame_stack[frame:])
    1.41 +
    1.42 +        # Provide the extra star parameter if necessary.
    1.43 +
    1.44 +        if nlocals == nargs:
    1.45 +            self.frame_stack.extend([None]) # ExtendFrame(1)
    1.46 +
    1.47      def FillDefaults(self):
    1.48          context, ref = self.value
    1.49          (nargs, ndefaults) = self.operand