On May 20, 2013, at 11:46 AM, Antoine Pitrou <solipsis at pitrou.net> wrote: > On Mon, 20 May 2013 07:12:07 -0700 > Ethan Furman <ethan at stoneleaf.us> wrote: >> >> As a case in point, base64.py is currently getting a bug fix, and also contains this code: >> >> def b32decode(s, casefold=False, map01=None): >> . >> . >> . >> for i in range(0, len(s), 8): >> quanta = s[i: i + 8] >> acc = 0 >> try: >> for c in quanta: >> acc = (acc << 5) + b32rev[c] >> except KeyError: >> raise binascii.Error('Non-base32 digit found') >> . >> . >> . >> else: >> raise binascii.Error('Incorrect padding') >> >> Does the KeyError qualify as irrelevant noise? > > I think it is a legitimate case where to silence the original > exception. However, the binascii.Error would be more informative if it > said *which* non-base32 digit was encountered. > And, if possible, the location (index) in the string. Eric.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4