[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Python3 support for hot-backup.py

From: Yasuhito FUTATSUKI <futatuki_at_yf.bsdclub.org>
Date: Mon, 15 Jun 2020 23:29:12 +0900

On 2020/06/15 21:38, C. Michael Pilato wrote:
> Reviewed, tested, and compared with similar Python3 conversions to other
> scripts. All looks good, so committed it:
>
> Sending backup/hot-backup.py.in
> Transmitting file data .done
> Committing transaction...
> Committed revision 1878855.

Is it needed something like this?

[[[
Index: tools/backup/hot-backup.py.in
===================================================================
--- tools/backup/hot-backup.py.in (revision 1878855)
+++ tools/backup/hot-backup.py.in (working copy)
@@ -218,7 +218,7 @@
 
   if stderr_lines:
     raise Exception("Unable to find the youngest revision for repository '%s'"
- ": %s" % (repo_dir, stderr_lines[0].rstrip()))
+ ": %s" % (repo_dir, stderr_lines[0].rstrip().decode()))
 
   return stdout_lines[0].strip().decode();
 
]]]

If svnlook runs on locale other than C, this can cause UnicodeDecodeError,
but without applying it, the output from svnlook is embeded as a representaion
of bytes object to the exception message, like b'...'.
(Although I think this script assuming C locale implicitly.)

So I'm not sure which is better applying this or not.

'return stdout_lines[0].strip().decode();' is okey (except an extra ';',
but it is not critical), because stdout_lines[0] is always ascii string
in this context.

Cheers,

-- 
Yasuhito FUTATSUKI <futatuki_at_yf.bsclub.org>
Received on 2020-06-15 16:32:23 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.