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

isinstance(url, URL) returns False for BaseURL #55

Closed
Gallaecio opened this issue Feb 15, 2017 · 4 comments
Closed

isinstance(url, URL) returns False for BaseURL #55

Gallaecio opened this issue Feb 15, 2017 · 4 comments

Comments

@Gallaecio
Copy link

Gallaecio commented Feb 15, 2017

Specifically, this evaluates to false: isinstance(URL('http://example.com').with_fragment(None), URL)

I tested it as follows:

[adrian@chakra yarl]$ python3 -m venv venv
[adrian@chakra yarl]$ . venv/bin/activate
(venv) [adrian@chakra yarl]$ pip install yarl
Collecting yarl
  Downloading yarl-0.9.5-cp35-cp35m-manylinux1_x86_64.whl (165kB)
    100% |████████████████████████████████| 174kB 2.1MB/s 
Collecting multidict>=2.0 (from yarl)
  Downloading multidict-2.1.4-cp35-cp35m-manylinux1_x86_64.whl (357kB)
    100% |████████████████████████████████| 358kB 746kB/s 
Installing collected packages: multidict, yarl
Successfully installed multidict-2.1.4 yarl-0.9.5
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(venv) [adrian@chakra yarl]$ echo "from yarl import URL" >> test.py
(venv) [adrian@chakra yarl]$ echo "print(isinstance(URL('http://example.com').with_fragment(None), URL))" >> test.py
(venv) [adrian@chakra yarl]$ python test.py 
False
(venv) [adrian@chakra yarl]$ 

I realize that there are many chances that I am the one doing something wrong here, as I found this issue debugging an exception raised by trivial aiohttp code.

If this is as expected, I will proceed to report the issue downstream to aiohttp.

@hellysmile
Copy link
Member

I have same problems

@Gallaecio
Copy link
Author

This happens in 0.9.4 and 0.9.5. Downgrading to 0.9.3 fixes it for me.

@arthurdarcet
Copy link

@fafhrd91 could you look at this? This breaks all HTTP requests made with the aiohttp client aio-libs/aiohttp#1632

I'm not sure why this BaseURL class was introduced, but returning something that isn't an instance of X in X.__new__ looks like a very bad idea to me. Could you revert this?

@fafhrd91
Copy link
Member

Yes, reverted

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

4 participants