diff Tools/scripts/checkappend.py @ 45888:51e24512e305

- Issue #719888: Updated tokenize to use a bytes API. generate_tokens has been renamed tokenize and now works with bytes rather than strings. A new detect_encoding function has been added for determining source file encoding according to PEP-0263. Token sequences returned by tokenize always start with an ENCODING token which specifies the encoding used to decode the file. This token is used to encode the output of untokenize back to bytes. Credit goes to Michael "I'm-going-to-name-my-first-child-unittest" Foord from Resolver Systems for this work.
author Trent Nelson <trent.nelson@snakebite.org>
date Tue, 18 Mar 2008 22:41:35 +0000
parents 46625e6122e9
children fcfe324663a6
line wrap: on
line diff
--- a/Tools/scripts/checkappend.py	Tue Mar 18 22:34:31 2008 +0000
+++ b/Tools/scripts/checkappend.py	Tue Mar 18 22:41:35 2008 +0000
@@ -103,7 +103,9 @@
 
     def run(self):
         try:
-            tokenize.tokenize(self.file.readline, self.tokeneater)
+            tokens = tokenize.generate_tokens(self.file.readline)
+            for _token in tokens:
+                self.tokeneater(*_token)
         except tokenize.TokenError as msg:
             errprint("%r: Token Error: %s" % (self.fname, msg))
             self.nerrors = self.nerrors + 1