[Python-checkins] python/dist/src/Lib pickle.py,1.110,1.111

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Tue, 28 Jan 2003 08:42:26 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv28786/Lib

Modified Files:
	pickle.py 
Log Message:
_is_string_secure():  This method is no longer used; removed it.  (It
was used before string-escape codecs were added to the core.)


Index: pickle.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pickle.py,v
retrieving revision 1.110
retrieving revision 1.111
diff -C2 -d -r1.110 -r1.111
*** pickle.py	28 Jan 2003 16:34:19 -0000	1.110
--- pickle.py	28 Jan 2003 16:42:22 -0000	1.111
***************
*** 846,886 ****
      dispatch[STRING] = load_string
  
-     def _is_string_secure(self, s):
-         """Return true if s contains a string that is safe to eval
- 
-         The definition of secure string is based on the implementation
-         in cPickle.  s is secure as long as it only contains a quoted
-         string and optional trailing whitespace.
-         """
-         q = s[0]
-         if q not in ("'", '"'):
-             return 0
-         # find the closing quote
-         offset = 1
-         i = None
-         while 1:
-             try:
-                 i = s.index(q, offset)
-             except ValueError:
-                 # if there is an error the first time, there is no
-                 # close quote
-                 if offset == 1:
-                     return 0
-             if s[i-1] != '\\':
-                 break
-             # check to see if this one is escaped
-             nslash = 0
-             j = i - 1
-             while j >= offset and s[j] == '\\':
-                 j = j - 1
-                 nslash = nslash + 1
-             if nslash % 2 == 0:
-                 break
-             offset = i + 1
-         for c in s[i+1:]:
-             if ord(c) > 32:
-                 return 0
-         return 1
- 
      def load_binstring(self):
          len = mloads('i' + self.read(4))
--- 846,849 ----