[Python-checkins] CVS: python/dist/src/Lib pickle.py,1.39,1.40

Guido van Rossum python-dev@python.org
Wed, 13 Dec 2000 10:11:59 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv19994

Modified Files:
	pickle.py 
Log Message:
Get rid of string module and string exceptions.


Index: pickle.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -r1.39 -r1.40
*** pickle.py	2000/09/15 15:14:51	1.39
--- pickle.py	2000/12/13 18:11:56	1.40
***************
*** 28,32 ****
  from types import *
  from copy_reg import dispatch_table, safe_constructors
- import string
  import marshal
  import sys
--- 28,31 ----
***************
*** 43,46 ****
--- 42,49 ----
  class UnpicklingError(PickleError): pass
  
+ class _Stop(Exception):
+     def __init__(self, value):
+         self.value = value
+ 
  try:
      from org.python.core import PyStringMap
***************
*** 515,520 ****
                  key = read(1)
                  dispatch[key](self)
!         except STOP, value:
!             return value
  
      def marker(self):
--- 518,523 ----
                  key = read(1)
                  dispatch[key](self)
!         except _Stop, stopinst:
!             return stopinst.value
  
      def marker(self):
***************
*** 550,554 ****
  
      def load_int(self):
!         self.append(string.atoi(self.readline()[:-1]))
      dispatch[INT] = load_int
  
--- 553,557 ----
  
      def load_int(self):
!         self.append(int(self.readline()[:-1]))
      dispatch[INT] = load_int
  
***************
*** 566,574 ****
   
      def load_long(self):
!         self.append(string.atol(self.readline()[:-1], 0))
      dispatch[LONG] = load_long
  
      def load_float(self):
!         self.append(string.atof(self.readline()[:-1]))
      dispatch[FLOAT] = load_float
  
--- 569,577 ----
   
      def load_long(self):
!         self.append(long(self.readline()[:-1], 0))
      dispatch[LONG] = load_long
  
      def load_float(self):
!         self.append(float(self.readline()[:-1]))
      dispatch[FLOAT] = load_float
  
***************
*** 873,877 ****
          value = self.stack[-1]
          del self.stack[-1]
!         raise STOP, value
      dispatch[STOP] = load_stop
  
--- 876,880 ----
          value = self.stack[-1]
          del self.stack[-1]
!         raise _Stop(value)
      dispatch[STOP] = load_stop