[PATCH] docdiff: fix TypeError when converting subproc args to native str (fixes #5909)

5 views
Skip to first unread message

Matt Harbison

unread,
Jul 5, 2023, 10:30:56 AM7/5/23
to thg...@googlegroups.com
# HG changeset patch
# User Matt Harbison <matt_h...@yahoo.com>
# Date 1688490640 14400
# Tue Jul 04 13:10:40 2023 -0400
# Branch stable
# Node ID 5a24eb0b779037d8655ef23f990e9c80949103dd
# Parent f55bd438ef90c8abed043c110ddde7454c67b49e
# EXP-Topic docdiff-fix
docdiff: fix TypeError when converting subproc args to native str (fixes #5909)

`procutil.tonativestr` wants AnyStr input, not a list.

diff --git a/win32/docdiff.py b/win32/docdiff.py
--- a/win32/docdiff.py
+++ b/win32/docdiff.py
@@ -100,9 +100,7 @@
encoding = locale.getpreferredencoding(do_setlocale=True)
cmd = [procutil.shellquote(safe_encode(arg, encoding)) for arg in cmd]

- # Only Windows has a unicode native string, so the arg warning still needs
- # to be disabled for non Windows platforms.
- cmdline = ' '.join(procutil.tonativestr(cmd)) # pytype: disable=wrong-arg-types
+ cmdline = ' '.join(pycompat.rapply(procutil.tonativestr, cmd))
proc = subprocess.Popen(cmdline, shell=True,
creationflags=win32con.CREATE_NO_WINDOW,
stderr=subprocess.PIPE,

Yuya Nishihara

unread,
Jul 5, 2023, 10:51:00 AM7/5/23
to Matt Harbison, thg...@googlegroups.com
On Wed, 05 Jul 2023 10:30:50 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_h...@yahoo.com>
> # Date 1688490640 14400
> # Tue Jul 04 13:10:40 2023 -0400
> # Branch stable
> # Node ID 5a24eb0b779037d8655ef23f990e9c80949103dd
> # Parent f55bd438ef90c8abed043c110ddde7454c67b49e
> # EXP-Topic docdiff-fix
> docdiff: fix TypeError when converting subproc args to native str (fixes #5909)

Queued for stable, thanks.
Reply all
Reply to author
Forward
0 new messages