earwig / bitshift

A semantic search engine for source code
https://bitshift.benkurtovic.com/
MIT License
30 stars 5 forks source link

Python parser bugs #78

Open earwig opened 10 years ago

earwig commented 10 years ago
14-07-05 19:37:56 DEBUG bitshift.crawler.indexer.GitIndexer Indexing file: kennethreitz/requests: requests/packages/urllib3/packages/six.py
14-07-05 19:37:56 ERROR bitshift.crawler.indexer.GitIndexer Exception raised while parsing:
Traceback (most recent call last):
  File "bitshift/crawler/indexer.py", line 169, in _insert_repository_codelets
    parse(codelet)
  File "bitshift/parser/__init__.py", line 83, in parse
    symbols = PARSERS[lang_string](codelet)
  File "bitshift/parser/python.py", line 216, in parse_py
    walker.visit(tree)
  File "/usr/lib/python2.7/ast.py", line 241, in visit
    return visitor(node)
  File "/usr/lib/python2.7/ast.py", line 249, in generic_visit
    self.visit(item)
  File "/usr/lib/python2.7/ast.py", line 241, in visit
    return visitor(node)
  File "/usr/lib/python2.7/ast.py", line 249, in generic_visit
    self.visit(item)
  File "/usr/lib/python2.7/ast.py", line 241, in visit
    return visitor(node)
  File "bitshift/parser/python.py", line 101, in visit_FunctionDef
    pos = self.block_position(node)
  File "bitshift/parser/python.py", line 46, in block_position
    temp_node = temp_node.body[-1]
TypeError: 'Str' object does not support indexing
earwig commented 10 years ago

Another one:

14-07-05 19:43:22 DEBUG bitshift.crawler.indexer.GitIndexer Indexing file: pypa/pip: pip/_vendor/pkg_resources.py
14-07-05 19:43:22 ERROR bitshift.crawler.indexer.GitIndexer Exception raised while parsing:
Traceback (most recent call last):
  File "bitshift/crawler/indexer.py", line 169, in _insert_repository_codelets
    parse(codelet)
  File "bitshift/parser/__init__.py", line 83, in parse
    symbols = PARSERS[lang_string](codelet)
  File "bitshift/parser/python.py", line 216, in parse_py
    walker.visit(tree)
  File "/usr/lib/python2.7/ast.py", line 241, in visit
    return visitor(node)
  File "/usr/lib/python2.7/ast.py", line 249, in generic_visit
    self.visit(item)
  File "/usr/lib/python2.7/ast.py", line 241, in visit
    return visitor(node)
  File "/usr/lib/python2.7/ast.py", line 249, in generic_visit
    self.visit(item)
  File "/usr/lib/python2.7/ast.py", line 241, in visit
    return visitor(node)
  File "/usr/lib/python2.7/ast.py", line 249, in generic_visit
    self.visit(item)
  File "/usr/lib/python2.7/ast.py", line 241, in visit
    return visitor(node)
  File "bitshift/parser/python.py", line 101, in visit_FunctionDef
    pos = self.block_position(node)
  File "bitshift/parser/python.py", line 46, in block_position
    temp_node = temp_node.body[-1]
TypeError: 'Tuple' object does not support indexing
earwig commented 10 years ago

Another one. I am only reporting unique errors.

14-07-05 19:55:13 DEBUG bitshift.crawler.indexer.GitIndexer Indexing file: ipython/ipython: IPython/config/loader.py
14-07-05 19:55:13 ERROR bitshift.crawler.indexer.GitIndexer Exception raised while parsing:
Traceback (most recent call last):
  File "bitshift/crawler/indexer.py", line 169, in _insert_repository_codelets
    parse(codelet)
  File "bitshift/parser/__init__.py", line 83, in parse
    symbols = PARSERS[lang_string](codelet)
  File "bitshift/parser/python.py", line 216, in parse_py
    walker.visit(tree)
  File "/usr/lib/python2.7/ast.py", line 241, in visit
    return visitor(node)
  File "/usr/lib/python2.7/ast.py", line 249, in generic_visit
    self.visit(item)
  File "/usr/lib/python2.7/ast.py", line 241, in visit
    return visitor(node)
  File "bitshift/parser/python.py", line 172, in visit_ClassDef
    self.generic_visit(node)
  File "/usr/lib/python2.7/ast.py", line 249, in generic_visit
    self.visit(item)
  File "/usr/lib/python2.7/ast.py", line 241, in visit
    return visitor(node)
  File "bitshift/parser/python.py", line 101, in visit_FunctionDef
    pos = self.block_position(node)
  File "bitshift/parser/python.py", line 46, in block_position
    temp_node = temp_node.body[-1]
TypeError: 'BinOp' object does not support indexing