From acb2eadc8e692be4c8212cf1d3697e10e298a384 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Fri, 16 Aug 2019 12:08:28 -0700 Subject: [PATCH] Specify the target Python version in the mypy configuration Currently targets Python 3.5. This caught a bug. The subprocess.run() function only started taking the 'encoding' keyword argument starting with Python 3.6. --- setup.cfg | 1 + sphinx/__init__.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 1f5bbd1cd..e4d577f93 100644 --- a/setup.cfg +++ b/setup.cfg @@ -40,6 +40,7 @@ paths = . [mypy] +python_version = 3.5 show_column_numbers = True show_error_context = True ignore_missing_imports = True diff --git a/sphinx/__init__.py b/sphinx/__init__.py index 1c8338643..690e0d71f 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -56,8 +56,8 @@ if __version__.endswith('+'): __version__ = __version__[:-1] # remove '+' for PEP-440 version spec. try: ret = subprocess.run(['git', 'show', '-s', '--pretty=format:%h'], - stdout=PIPE, stderr=PIPE, encoding='ascii') + stdout=PIPE, stderr=PIPE) if ret.stdout: - __display_version__ += '/' + ret.stdout.strip() + __display_version__ += '/' + ret.stdout.decode('ascii').strip() except Exception: pass