Skip to content

"no overload variant" with urlparse(..., allow_fragments=...)  #2640

Closed
@madeleine-empirical

Description

@madeleine-empirical

I am confused by an error I'm getting with a urlparse call. This may be related to #1907, but I don't know.

Here's a minimal reproduction case:

from urllib.parse import urlparse

# Gives a mypy error:
u = urlparse('https://example.com/#frag', allow_fragments=False)
print(u)

# Does not give a mypy error:
u2 = urlparse('https://example.com/#frag')
print(u2)

If I run this, it gives the output I expect:

$ python test.py 
ParseResult(scheme='https', netloc='example.com', path='/#frag', params='', query='', fragment='')
ParseResult(scheme='https', netloc='example.com', path='/', params='', query='', fragment='frag')

If I run mypy on it, I get:

$ mypy --fast-parser test.py
test.py:4: error: No overload variant of "urlparse" matches argument types [builtins.str, builtins.bool]
$ mypy test.py
test.py:4: error: No overload variant of "urlparse" matches argument types [builtins.str, builtins.bool]

The typeshed code looks reasonable to me.

software versions:

$ python --version
Python 3.5.2
$ pip list
mypy-lang (0.4.7.dev0)
pip (9.0.1)
setuptools (32.3.1)
typed-ast (0.6.1)
wheel (0.30.0a0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions