Ignore:
Timestamp:
Mar 19, 2014, 11:11:30 AM (11 years ago)
Author:
dmik
Message:

python: Update vendor to 2.7.6.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/vendor/current/Lib/pickle.py

    r2 r388  
    2525"""
    2626
    27 __version__ = "$Revision: 65524 $"       # Code version
     27__version__ = "$Revision: 72223 $"       # Code version
    2828
    2929from types import *
     
    287287            return
    288288
    289         # Check for a class with a custom metaclass; treat as regular class
    290         try:
    291             issc = issubclass(t, TypeType)
    292         except TypeError: # t is not a class (old Boost; see SF #502085)
    293             issc = 0
    294         if issc:
    295             self.save_global(obj)
    296             return
    297 
    298289        # Check copy_reg.dispatch_table
    299290        reduce = dispatch_table.get(t)
     
    301292            rv = reduce(obj)
    302293        else:
     294            # Check for a class with a custom metaclass; treat as regular class
     295            try:
     296                issc = issubclass(t, TypeType)
     297            except TypeError: # t is not a class (old Boost; see SF #502085)
     298                issc = 0
     299            if issc:
     300                self.save_global(obj)
     301                return
     302
    303303            # Check for a __reduce_ex__ method, fall back to __reduce__
    304304            reduce = getattr(obj, "__reduce_ex__", None)
     
    502502    dispatch[UnicodeType] = save_unicode
    503503
    504     if StringType == UnicodeType:
     504    if StringType is UnicodeType:
    505505        # This is true for Jython
    506506        def save_string(self, obj, pack=struct.pack):
     
    963963        for q in "\"'": # double or single quote
    964964            if rep.startswith(q):
    965                 if not rep.endswith(q):
     965                if len(rep) < 2 or not rep.endswith(q):
    966966                    raise ValueError, "insecure string pickle"
    967967                rep = rep[len(q):-len(q)]
     
    12221222        if state:
    12231223            try:
    1224                 inst.__dict__.update(state)
     1224                d = inst.__dict__
     1225                try:
     1226                    for k, v in state.iteritems():
     1227                        d[intern(k)] = v
     1228                # keys in state don't have to be strings
     1229                # don't blow up, but don't go out of our way
     1230                except TypeError:
     1231                    d.update(state)
     1232
    12251233            except RuntimeError:
    12261234                # XXX In restricted execution, the instance's __dict__
Note: See TracChangeset for help on using the changeset viewer.