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

Crash on nested square brackets in type annotation #120

Open
tmke8 opened this issue Apr 20, 2022 · 0 comments
Open

Crash on nested square brackets in type annotation #120

tmke8 opened this issue Apr 20, 2022 · 0 comments

Comments

@tmke8
Copy link

tmke8 commented Apr 20, 2022

pyment crashes on this function:

def map_over_results_index(
    results: Results,
    mapper: Callable[[Tuple[str, str, str, str, str]], Tuple[str, str, str, str, str]],
) -> Results:
    """Change the values of the index with a transformation function."""

though I'm pretty sure that this is valid (type checkers like mypy don't complain).

Traceback (most recent call last):
  File "[...]/bin/pyment", line 8, in <module>
    sys.exit(main())
  File "[...]/lib/python3.9/site-packages/pyment/pymentapp.py", line 171, in main
    run(source, files, args.input, args.output,
  File "[...]/lib/python3.9/site-packages/pyment/pymentapp.py", line 105, in run
    c.proceed()
  File "[...]/lib/python3.9/site-packages/pyment/pyment.py", line 378, in proceed
    self._parse()
  File "[...]/lib/python3.9/site-packages/pyment/pyment.py", line 132, in _parse
    e = DocString(elem.replace('\n', ' '), spaces, quotes=self.quotes,
  File "[...]/lib/python3.9/site-packages/pyment/docstring.py", line 1377, in __init__
    self.parse_definition()
  File "[...]/lib/python3.9/site-packages/pyment/docstring.py", line 1490, in parse_definition
    extracted = self._extract_signature_elements(self._remove_signature_comment(l))
  File "[...]/lib/python3.9/site-packages/pyment/docstring.py", line 1547, in _extract_signature_elements
    raise Exception("unexpected nested element after "+str(inside)+" while reading "+reading)
Exception: unexpected nested element after [ while reading param
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant