Julian Foad wrote on Tue, 25 Jan 2022 13:15 +00:00:
> On a trunk WC (updated today) I get:
>
>   File 
> "/home/julianfoad/src/subversion-d/subversion/tests/cmdline/svntest/main.py", 
> line 619, in <genexpr>
>     assert all(isinstance(arg, (str, unicode, int)) for arg in varargs)
> NameError: name 'unicode' is not defined
>
> This is on Ubuntu 21.10 with Python 3.9. Is the 'unicode' class name too
> old or too new for this Python?

Yes:

$ python2 -c 'print(type(""), type(b""), type(u""))' 
(<type 'str'>, <type 'str'>, <type 'unicode'>)
$ python3 -c 'print(type(""), type(b""), type(u""))' 
<class 'str'> <class 'bytes'> <class 'str'>

So, I think changing the check to «isinstance(arg, (type(b""),
type(u""), int))» would work on both py2 and py3.  We can't just remove
«unicode» from there because that'd break svnrdump_tests under py2.

Incidentally, Python 2 has separate «int» and «long» types (e.g, 2**63
evaluates to a «long») whereas Python 3 has only «int», but that's easy
to handle one way or another.

Thanks for the confirmation elsethread.

Cheers,

Daniel

Reply via email to