Patchwork [1,of,6] py3: catch binascii.Error raised from binascii.unhexlify

login
register
mail settings
Submitter Pulkit Goyal
Date June 20, 2017, 11:31 p.m.
Message ID <c4652d1f51f2069505f8.1498001487@workspace>
Download mbox | patch
Permalink /patch/21548/
State Accepted
Headers show

Comments

Pulkit Goyal - June 20, 2017, 11:31 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1497976906 -19800
#      Tue Jun 20 22:11:46 2017 +0530
# Node ID c4652d1f51f2069505f88491ba37bbb1a132af98
# Parent  6d79e9109908c2cb468c9eeaf8869aa1926fbea8
py3: catch binascii.Error raised from binascii.unhexlify

Before Python 3, binsacii.unhexlify used to raise TypeError, now it raises
binascii.Error.

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -13,6 +13,7 @@ 
 
 from __future__ import absolute_import
 
+import binascii
 import collections
 import errno
 import hashlib
@@ -1094,7 +1095,7 @@ 
                 if maybewdir:
                     raise error.WdirUnsupported
                 return None
-            except TypeError:
+            except (TypeError, binascii.Error):
                 pass
 
     def lookup(self, id):