Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lexer exceeds maximum recursion depth if too many comments #1280

Closed
tsavola opened this issue Mar 9, 2016 · 3 comments
Closed

Lexer exceeds maximum recursion depth if too many comments #1280

tsavola opened this issue Mar 9, 2016 · 3 comments
Assignees
Labels
bug mypy got something wrong

Comments

@tsavola
Copy link

tsavola commented Mar 9, 2016

This happened when I commented out a long block of code (over 600 lines or so):

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "mypy/__main__.py", line 5, in <module>
    main(None)
  File "mypy/main.py", line 50, in main
    type_check_only(sources, bin_dir, options)
  File "mypy/main.py", line 94, in type_check_only
    python_path=options.python_path)
  File "mypy/build.py", line 210, in build
    result = manager.process(initial_states)
  File "mypy/build.py", line 427, in process
    next.process()
  File "mypy/build.py", line 759, in process
    tree = self.parse(self.program_text, self.path)
  File "mypy/build.py", line 856, in parse
    fast_parser=FAST_PARSER in self.manager.flags)
  File "mypy/parse.py", line 98, in parse
    tree = parser.parse(source)
  File "mypy/parse.py", line 147, in parse
    is_stub_file=self.is_stub_file)
  File "mypy/lex.py", line 170, in lex
    l.lex(string, first_line)
  File "mypy/lex.py", line 378, in lex
    map.get(c, default)()
  File "mypy/lex.py", line 751, in lex_break
    self.lex_indent()
  File "mypy/lex.py", line 698, in lex_indent
    self.lex_indent()
  File "mypy/lex.py", line 698, in lex_indent
    self.lex_indent()

  [...]

  File "mypy/lex.py", line 698, in lex_indent
    self.lex_indent()
  File "mypy/lex.py", line 697, in lex_indent
    self.lex_break()
  File "mypy/lex.py", line 735, in lex_break
    s = self.match(self.break_exp)
RecursionError: maximum recursion depth exceeded
@gvanrossum gvanrossum added the bug mypy got something wrong label Mar 9, 2016
@gvanrossum
Copy link
Member

Eew! Good thing we're working on replacing the parser completely with a port of the ast module. (@ddfisher's project.)

@ddfisher ddfisher added this to the 0.3.2 milestone Apr 7, 2016
@gvanrossum
Copy link
Member

We don't have to do this assuming #1353 lands soon.

@ddfisher ddfisher self-assigned this Apr 14, 2016
@gvanrossum gvanrossum assigned gvanrossum and unassigned ddfisher Apr 25, 2016
@gvanrossum
Copy link
Member

I'm fixing this in the original code too, as a "plan B" in case typed_ast is delayed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

3 participants