Skip to content

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

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
madeleine-empirical opened this issue Jan 5, 2017 · 2 comments
Closed

Comments

@madeleine-empirical
Copy link

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)
@rwbarton
Copy link
Contributor

rwbarton commented Jan 5, 2017

The stubs say allow_framgents. Oops...

Can you file this on typeshed instead?

@madeleine-empirical
Copy link
Author

Thanks; that's an easy explanation. PR'd as python/typeshed#812.

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

2 participants