From 783a977936a6573ecc71dbbbe23116a2c94fcc51 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Fri, 22 Jun 2018 17:04:03 -0400 Subject: Fix bug where constant string in python action yielded trying to join an array of items one of which was unicode. --- src/engine/SCons/Util.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index ec29796..b566088 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -1610,9 +1610,13 @@ del __revision__ def to_bytes (s): if s is None: return b'None' + if not PY3 and isinstance(s, UnicodeType): + # PY2, must encode unicode + return bytes(s, 'utf-8') if isinstance (s, (bytes, bytearray)) or bytes is str: + # Above case not covered here as py2 bytes and strings are the same return s - return bytes (s, 'utf-8') + return bytes(s, 'utf-8') def to_str (s): if s is None: -- cgit v0.12