On Fri, 2020-11-06 at 22:06 +0100, Xavier wrote:
> sorry, I launched a full rebuild in unstable and didn't see this change.
> However I don't understand this error (I'm not Python dev), code is:
> 
>  try:
>    # maketrans moved to str in python3.
>    _maketrans = string.maketrans
>  except NameError:
>    _maketrans = str.maketrans
> 
> So error should be discarded, isn't it?

It seems wrong exception is handled here. NameError[1] happens when
unknown top-level variable is referenced. However, above this line,
there is importing of string module. So NameError is not possible here.
I daresay an original author meant AttributeError[2] here that is raised
when code is trying to get non-existent attribute (a thing after dot).

I suggest replace NameError with AttributeError:

   try:
     # maketrans moved to str in python3.
     _maketrans = string.maketrans
   except AttributeError:
     _maketrans = str.maketrans

(not tested)

 [1]: https://docs.python.org/3/library/exceptions.html#NameError
 [2]: https://docs.python.org/3/library/exceptions.html#AttributeError

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to