Anonymous committed 57f2642

minor cleanup
(transplanted from 4feb1b15eb7a0c76cb020e09817c509a782d45b7)

  • Participants
  • Parent commits 11a3fc2
  • Branches python3-port

Comments (0)

Files changed (2)

File src/engine/SCons/

     def get_contents(self, target, source, env):
         result = [ self.get_presig(target, source, env) ]
-        def clean (u):
-            if isinstance (u, bytes):
-                return u
-            elif isinstance (u, str):
-                return bytes (u, 'utf-8')
-        result = [ clean(r) for r in result ]
+        result = [ SCons.Util.to_bytes(r) for r in result ]
         # This should never happen, as the Action() factory should wrap
         # the varlist, but just in case an action is created directly,
         # we duplicate this check here.

File src/engine/SCons/

 del __revision__
 def to_bytes (s):
-    if bytes is str:
+    if isinstance (s, bytes) or bytes is str:
         return s
         return bytes (s, 'utf-8')