py3: fix comparison between int and None
If stop is None, the condition was always false on Python 2, as None compares
smaller than ints. Therefore we make the condition false if stop is None.
py3: avoid using %r format on bytes
Before the patch, the 'b' prefix appeared in the formatted string. Wrapping the
bytes as pycompat.bytestr solves this problem.
Eventually, I think that we should move away from using %r (like
975e517451a6
and
4d6019c0e0ef did), but that would change output of non-ASCII bytes on
Python 2, so we can’t do it on the stable branch. Also, many places continue to
use %r, so it would be a good idea to do the change all at once.
py3: use `%d` for int in % formatting
On Python 3, `%s` is an alias to `%b`, which requires that the object implements
`__bytes__()`, which is not the case for `int`.
py3: pass native string to urlreq.url2pathname()
Of course, I’m not happy with the warning, but it’s better than crashing.
Solving the problem properly is hard, and non-UTF-8 percent-encoded bytes in
file URLs seem rare enough to block solving that all file URLs (even if not
SVN-specific) will cause a crash.
py3: suppress DeprecationWarning about deprecated base64 module aliases
base64.encodestring() / base64.decodestring() were renamed to
base64.encodebytes() / base64.decodebytes() in Python 3. The old names still
worked, but raised a DeprecationWarning.
py3: use `%d` for int in % formatting
On Python 3, `%s` is an alias to `%b`, which requires that the object implements
`__bytes__()`, which is not the case for `int`.
py3: unbyteify arguments to warnings.filterwarnings()
This fixes a crash when trying to import the convert extension on Python 3.