hgext/lfs/blobstore.py
changeset 48934 06de08b36c82
parent 48875 6000f5b25c9b
child 48946 642e31cb55f0
equal deleted inserted replaced
48933:78f1de3f4be7 48934:06de08b36c82
   271         try:  # usually it is in the form (errno, strerror)
   271         try:  # usually it is in the form (errno, strerror)
   272             reason = inst.reason.args[1]
   272             reason = inst.reason.args[1]
   273         except (AttributeError, IndexError):
   273         except (AttributeError, IndexError):
   274             # it might be anything, for example a string
   274             # it might be anything, for example a string
   275             reason = inst.reason
   275             reason = inst.reason
   276         if isinstance(reason, pycompat.unicode):
   276         if isinstance(reason, str):
   277             # SSLError of Python 2.7.9 contains a unicode
   277             # SSLError of Python 2.7.9 contains a unicode
   278             reason = encoding.unitolocal(reason)
   278             reason = encoding.unitolocal(reason)
   279         return reason
   279         return reason
   280     elif getattr(inst, "strerror", None):
   280     elif getattr(inst, "strerror", None):
   281         return encoding.strtolocal(inst.strerror)
   281         return encoding.strtolocal(inst.strerror)
   404                     )
   404                     )
   405                 )
   405                 )
   406             )
   406             )
   407 
   407 
   408         def encodestr(x):
   408         def encodestr(x):
   409             if isinstance(x, pycompat.unicode):
   409             if isinstance(x, str):
   410                 return x.encode('utf-8')
   410                 return x.encode('utf-8')
   411             return x
   411             return x
   412 
   412 
   413         return pycompat.rapply(encodestr, response)
   413         return pycompat.rapply(encodestr, response)
   414 
   414