From 1639aef197db54a3522293f16ed0acc34e0e955f Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Mon, 11 Jan 2021 15:29:32 -0500 Subject: [PATCH] Get rid of the argv unmangling that we no longer do --- src/allmydata/windows/fixups.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/allmydata/windows/fixups.py b/src/allmydata/windows/fixups.py index 237f96ca5..d34404aed 100644 --- a/src/allmydata/windows/fixups.py +++ b/src/allmydata/windows/fixups.py @@ -161,29 +161,13 @@ def initialize(): except Exception as e: _complain("exception %r while fixing up sys.stdout and sys.stderr" % (e,)) - # This works around . - - # Because of (and similar limitations in - # twisted), the 'bin/tahoe' script cannot invoke us with the actual Unicode arguments. - # Instead it "mangles" or escapes them using \x7F as an escape character, which we - # unescape here. - def unmangle(s): - return re.sub(u'\\x7F[0-9a-fA-F]*\\;', lambda m: unichr(int(m.group(0)[1:-1], 16)), s) - - argv_unicode = get_argv() - try: - argv = [unmangle(argv_u).encode('utf-8') for argv_u in argv_unicode] - except Exception as e: - _complain("%s: could not unmangle Unicode arguments.\n%r" - % (sys.argv[0], argv_unicode)) - raise + argv = list(arg.encode("utf-8") for arg in get_argv()) # Take only the suffix with the same number of arguments as sys.argv. # This accounts for anything that can cause initial arguments to be stripped, # for example, the Python interpreter or any options passed to it, or runner # scripts such as 'coverage run'. It works even if there are no such arguments, # as in the case of a frozen executable created by bb-freeze or similar. - sys.argv = argv[-len(sys.argv):]