# HG changeset patch # User Gregory Szorc # Date 1489281242 28800 # Node ID 70bc35df3e54cfb9b5db70d4150ad988e61c8e01 # Parent 78ac7061f84000a0b1e6dae1c3f363324d8e1aba setup: convert setupversion to unicode Something deep in the bowels of distutils expects "version" passed to setup() to be a str/unicode. So, convert the type. This still works on Python 2 because the string is ascii and an implicit coercion back to str/bytes should work without issue. If it does cause problems, we can always make the unicode conversion dependent on running Python 3. This change makes `python3.5 setup.py install` work. diff -r 78ac7061f840 -r 70bc35df3e54 setup.py --- a/setup.py Wed Jan 14 01:15:26 2015 +0100 +++ b/setup.py Sat Mar 11 17:14:02 2017 -0800 @@ -661,7 +661,14 @@ packagedata['mercurial'].append(f) datafiles = [] -setupversion = version + +# distutils expects version to be str/unicode. Converting it to +# unicode on Python 2 still works because it won't contain any +# non-ascii bytes and will be implicitly converted back to bytes +# when operated on. +assert isinstance(version, bytes) +setupversion = version.decode('ascii') + extra = {} if py2exeloaded: