]> granicus.if.org Git - python/commitdiff
Fix #1494787 (pyclbr counts whitespace as superclass name)
authorGeorg Brandl <georg@python.org>
Mon, 29 May 2006 14:39:00 +0000 (14:39 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 29 May 2006 14:39:00 +0000 (14:39 +0000)
Lib/pyclbr.py

index 0812e22ff4734ccbb4940064b186c2335ea5f314..073122417d7b4849e7ad409e231dc86fa70f1d91 100644 (file)
@@ -42,7 +42,7 @@ Instances of this class have the following instance variables:
 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 @@ def _readmodule(module, path, inpackage=None):
                                 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: