Skip to content

Empty tuple syntax #432

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

Closed
srittau opened this issue Oct 12, 2019 · 1 comment
Closed

Empty tuple syntax #432

srittau opened this issue Oct 12, 2019 · 1 comment
Assignees
Labels

Comments

@srittau
Copy link
Contributor

srittau commented Oct 12, 2019

I seem to have a knack for uncovering pytype snags with my typeshed PRs. This time it's python/typeshed#3351. CI failure: https://travis-ci.org/python/typeshed/jobs/597038126

Running pytype manually I get the following output:

$ pytype-single --parse-pyi --module-name=multiprocessing.shared_memory -V3.6 stdlib/3/multiprocessing/shared_memory.pyi 
Traceback (most recent call last):
  File "/home/srittau/Projekte/typeshed/.venv/lib/python3.7/site-packages/pytype/pyi/parser.py", line 430, in parse
    defs = parser_ext.parse(self, src)
pytype.pyi.parser.ParseError: ParseError: syntax error, unexpected ')'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./.venv/bin/pytype-single", line 11, in <module>
    load_entry_point('pytype==2019.9.17', 'console_scripts', 'pytype-single')()
  File "/home/srittau/Projekte/typeshed/.venv/lib/python3.7/site-packages/pytype/main.py", line 88, in main
    return _run_pytype(options)
  File "/home/srittau/Projekte/typeshed/.venv/lib/python3.7/site-packages/pytype/main.py", line 96, in _run_pytype
    unused_ast = io.parse_pyi(options)
  File "/home/srittau/Projekte/typeshed/.venv/lib/python3.7/site-packages/pytype/io.py", line 263, in parse_pyi
    ast = loader.load_file(options.module_name, options.input)
  File "/home/srittau/Projekte/typeshed/.venv/lib/python3.7/site-packages/pytype/load_pytd.py", line 241, in load_file
    python_version=self.python_version)
  File "/home/srittau/Projekte/typeshed/.venv/lib/python3.7/site-packages/pytype/pyi/parser.py", line 1250, in parse_file
    src, name, filename)
  File "/home/srittau/Projekte/typeshed/.venv/lib/python3.7/site-packages/pytype/pyi/parser.py", line 440, in parse
    column=self._error_location[1], text=text)
pytype.pyi.parser.ParseError:   File: "stdlib/3/multiprocessing/shared_memory.pyi", line 24
    def __reduce__(self: _S) -> Tuple[_S, Tuple[()]]: ...
                                                 ^

I assume, pytype does not support PEP 484's empty tuple syntax yet (Tuple[()]).

@rchen152 rchen152 added the bug label Oct 15, 2019
@rchen152 rchen152 self-assigned this Oct 15, 2019
@rchen152
Copy link
Contributor

Well, it's a little embarrassing that our parser keeps throwing up =(
I think I've fixed all the issues that came up, pending a GitHub sync and release.

rchen152 added a commit that referenced this issue Oct 15, 2019
Fixes #432.

PiperOrigin-RevId: 274886637
rchen152 added a commit that referenced this issue Oct 15, 2019
Fixes #432.

PiperOrigin-RevId: 274886637
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants