Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/shelve.py @ 51860:adbfbbf9963f
shelve: consistently convert exception to bytes via `stringutil.forcebytestr`
The other two places in this module use this, and past experience shows that
this method does a nicer job. I'm not sure why we're converting to bytes here-
`KeyError` is built-in and will have str attrs, and `RepoLookupError` is a
subclass of the built-in `Exception` class (not `errors.Error`, which is
allegedly the baseclass for all Mercurial exceptions).
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 20 Aug 2024 22:47:11 -0400 |
parents | a1a94d488e14 |
children | 607e94e01851 |
comparison
equal
deleted
inserted
replaced
51859:a1a94d488e14 | 51860:adbfbbf9963f |
---|---|
389 obj.activebookmark = b'' | 389 obj.activebookmark = b'' |
390 if d.get(b'activebook', b'') != cls._noactivebook: | 390 if d.get(b'activebook', b'') != cls._noactivebook: |
391 obj.activebookmark = d.get(b'activebook', b'') | 391 obj.activebookmark = d.get(b'activebook', b'') |
392 obj.interactive = d.get(b'interactive') == cls._interactive | 392 obj.interactive = d.get(b'interactive') == cls._interactive |
393 except (error.RepoLookupError, KeyError) as err: | 393 except (error.RepoLookupError, KeyError) as err: |
394 raise error.CorruptedState(pycompat.bytestr(err)) | 394 raise error.CorruptedState(stringutil.forcebytestr(err)) |
395 | 395 |
396 return obj | 396 return obj |
397 | 397 |
398 @classmethod | 398 @classmethod |
399 def save( | 399 def save( |