Address review comments.

This commit is contained in:
Itamar Turner-Trauring 2021-03-17 15:27:45 -04:00
parent 3c8e18f0fc
commit 2eba96de61
3 changed files with 9 additions and 10 deletions

View File

@ -1,6 +1,7 @@
# coding: utf-8
from __future__ import print_function
from six import ensure_str
import os, sys, textwrap
import codecs
@ -286,7 +287,5 @@ def escape_path(path):
"""
segments = path.split("/")
result = "/".join([urllib.parse.quote(unicode_to_url(s)) for s in segments])
# fixme: test.cli.test_create_alias fails if it gets Unicode on Python 2
if PY2 and isinstance(result, type(u'')):
result = result.encode('ascii')
result = ensure_str(result, "ascii")
return result

View File

@ -174,8 +174,9 @@ def _maybe_enable_eliot_logging(options, reactor):
return options
def run():
if not six.PY2:
warnings.warn("Support for Python 3 is experimental. Use at your own risk.")
if six.PY3:
warnings.warn("Support for Python 3 is an incomplete work-in-progress."
" Use at your own risk.")
if sys.platform == "win32":
from allmydata.windows.fixups import initialize

View File

@ -12,6 +12,9 @@ from __future__ import unicode_literals
from future.utils import PY2
if PY2:
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
from six import ensure_text
import os.path, re, sys
from os import linesep
@ -19,8 +22,6 @@ from eliot import (
log_call,
)
import six
from twisted.trial import unittest
from twisted.internet import reactor
@ -83,9 +84,7 @@ def run_bintahoe(extra_argv, python_options=None):
:return: A three-tuple of stdout (unicode), stderr (unicode), and the
child process "returncode" (int).
"""
# fixme: below, 'unicode_to_argv' is called so ensure that
# executable is unicode to support that expectation.
executable = sys.executable.decode('utf-8') if six.PY2 else sys.executable
executable = ensure_text(sys.executable)
argv = [executable]
if python_options is not None:
argv.extend(python_options)