Improve gclient Python 3 compatibility

This enables gclient sync and gclient runhooks to run, barring hook script failures.
git cl upload also now works.

The scripts still work with Python 2.
There are no intended behaviour changes.

Bug: 942522
Change-Id: I2ac587b5f803ba7f5bb5e412337ce049f4b1a741
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1524583
Commit-Queue: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index b1383a8..59a9af7 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -4443,7 +4443,7 @@
   # entropy.
   lines.append(message)
   change_hash = RunCommand(['git', 'hash-object', '-t', 'commit', '--stdin'],
-                           stdin='\n'.join(lines))
+                           stdin=('\n'.join(lines)).encode())
   return 'I%s' % change_hash.strip()