[Python-checkins] python/nondist/sandbox/pickletools pickletools.py,1.4,1.5

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Sat, 25 Jan 2003 18:43:40 -0800


Update of /cvsroot/python/python/nondist/sandbox/pickletools
In directory sc8-pr-cvs1:/tmp/cvs-serv32471

Modified Files:
	pickletools.py 
Log Message:
s/PythonObject/StackObject/g.


Index: pickletools.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/pickletools/pickletools.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** pickletools.py	25 Jan 2003 23:45:48 -0000	1.4
--- pickletools.py	26 Jan 2003 02:43:38 -0000	1.5
***************
*** 281,290 ****
  
  ##############################################################################
! # Python object descriptors.  The stack used by the pickle machine holds
! # Python objects, and in the stack_before and stack_after attributes of
! # OpcodeInfo descriptors we need names to describe the various types
! # of Python objects that can appear on the stack.
  
! class PythonObject(object):
      __slots__ = (
          # name of descriptor record, also a module global name; a string
--- 281,290 ----
  
  ##############################################################################
! # Object descriptors.  The stack used by the pickle machine holds objects,
! # and in the stack_before and stack_after attributes of OpcodeInfo
! # descriptors we need names to describe the various types of objects that can
! # appear on the stack.
  
! class StackObject(object):
      __slots__ = (
          # name of descriptor record, also a module global name; a string
***************
*** 304,307 ****
--- 304,310 ----
  
          assert isinstance(obtype, type) or isinstance(obtype, tuple)
+         if isinstance(obtype, tuple):
+             for contained in obtype:
+                 assert isinstance(contained, type)
          self.obtype = obtype
  
***************
*** 310,329 ****
  
  
! pyint = PythonObject(
              name='int',
              obtype=int,
              doc="A short (as opposed to long) Python integer object.")
  
! pylong = PythonObject(
               name='long',
               obtype=long,
               doc="A long (as opposed to short) Python integer object.")
  
! pyinteger = PythonObject(
                  name='integer',
                  obtype=(int, long),
                  doc="A Python integer object, short or long.")
  
! pyfloat = PythonObject(
                name='float',
                obtype=float,
--- 313,332 ----
  
  
! pyint = StackObject(
              name='int',
              obtype=int,
              doc="A short (as opposed to long) Python integer object.")
  
! pylong = StackObject(
               name='long',
               obtype=long,
               doc="A long (as opposed to short) Python integer object.")
  
! pyinteger = StackObject(
                  name='integer',
                  obtype=(int, long),
                  doc="A Python integer object, short or long.")
  
! pyfloat = StackObject(
                name='float',
                obtype=float,
***************
*** 368,377 ****
--- 371,386 ----
  
          assert isinstance(args, list)
+         for x in args:
+             assert isinstance(x, ArgumentDescriptor)
          self.args = args
  
          assert isinstance(stack_before, list)
+         for x in stack_before:
+             assert isinstance(x, StackObject)
          self.stack_before = stack_before
  
          assert isinstance(stack_after, list)
+         for x in stack_after:
+             assert isinstance(x, StackObject)
          self.stack_after = stack_after