byteify-strings: prevent "__name__ == '__main__'" from being transformed
This was okay for import-time code transformer, but shouldn't be applied to
source code.
--- a/contrib/byteify-strings.py Wed Aug 15 17:06:12 2018 -0400
+++ b/contrib/byteify-strings.py Sun Aug 12 14:03:22 2018 +0900
@@ -169,6 +169,11 @@
yield adjusttokenpos(t._replace(string=fn[4:]), coloffset)
continue
+ # Looks like "if __name__ == '__main__'".
+ if (t.type == token.NAME and t.string == '__name__'
+ and _isop(i + 1, '==')):
+ _ensuresysstr(i + 2)
+
# Emit unmodified token.
yield adjusttokenpos(t, coloffset)