[Twisted-Python] keyword changed API

Andrea Arcangeli andrea at cpushare.com
Sat Dec 4 10:10:19 MST 2004


This fixes a little runtime issue with the new python version:

--- ./python/htmlizer.py.~1~	2004-11-28 05:00:05.000000000 +0100
+++ ./python/htmlizer.py	2004-12-04 18:06:06.329802464 +0100
@@ -22,7 +22,7 @@ class TokenPrinter:
             type = "identifier"
             self.parameters = 1
         elif type == tokenize.NAME:
-             if keyword.kwdict.has_key(token):
+             if keyword.iskeyword(token):
                  type = 'keyword'
              else:
                  if self.parameters:

Not sure what's the right way to fix these things to retain backwards
compatibility (perhaps checking sys.version_info?).




More information about the Twisted-Python mailing list