[Python-checkins] r46526 - python/trunk/Lib/pyclbr.py

georg.brandl python-checkins at python.org
Mon May 29 16:39:00 CEST 2006


Author: georg.brandl
Date: Mon May 29 16:39:00 2006
New Revision: 46526

Modified:
   python/trunk/Lib/pyclbr.py
Log:
Fix #1494787 (pyclbr counts whitespace as superclass name)



Modified: python/trunk/Lib/pyclbr.py
==============================================================================
--- python/trunk/Lib/pyclbr.py	(original)
+++ python/trunk/Lib/pyclbr.py	Mon May 29 16:39:00 2006
@@ -42,7 +42,7 @@
 import sys
 import imp
 import tokenize # Python tokenizer
-from token import NAME, DEDENT, NEWLINE
+from token import NAME, DEDENT, NEWLINE, OP
 from operator import itemgetter
 
 __all__ = ["readmodule", "readmodule_ex", "Class", "Function"]
@@ -219,8 +219,10 @@
                                 break
                         elif token == ',' and level == 1:
                             pass
-                        else:
+                        # only use NAME and OP (== dot) tokens for type name
+                        elif tokentype in (NAME, OP) and level == 1:
                             super.append(token)
+                        # expressions in the base list are not supported
                     inherit = names
                 cur_class = Class(fullmodule, class_name, inherit, file, lineno)
                 if not stack:


More information about the Python-checkins mailing list