Skip to content

test_no_scheme2 fails with Python 3.11 #803

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
1 task done
s3v- opened this issue Dec 29, 2022 · 6 comments
Closed
1 task done

test_no_scheme2 fails with Python 3.11 #803

s3v- opened this issue Dec 29, 2022 · 6 comments
Labels

Comments

@s3v-
Copy link

s3v- commented Dec 29, 2022

Describe the bug

test_no_scheme2 fails with Python 3.11. See:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1026634
(or your Actions log).

> =================================== FAILURES ===================================
> ________________________ TestScheme.test_not_a_scheme2 _________________________
> 
> self = <test_url_parsing.TestScheme object at 0x7f6efadeb150>
> 
>     def test_not_a_scheme2(self):
>         u = URL("37signals:book")
> >       assert u.scheme == "37signals"
> E       AssertionError: assert '' == '37signals'
> E         - 37signals
> 
> tests/test_url_parsing.py:77: AssertionError

Python 3.10 or lower:

Python 3.10.9 (main, Dec  7 2022, 13:47:07) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib.parse import urlsplit
>>> urlsplit('37signals:book')
SplitResult(scheme='37signals', netloc='', path='book', query='', fragment='')
>>> 

Python 3.11:

Python 3.11.1 (main, Dec  7 2022, 08:49:13) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib.parse import urlsplit
>>> urlsplit('37signals:book')
SplitResult(scheme='', netloc='', path='37signals:book', query='', fragment='')
>>> 

Kind Regards

To Reproduce

Just run the test with Python 3.11

Expected behavior

Test succeeds

Logs/tracebacks

n\a

Python Version

Python 3.11.1

multidict Version

n\a

yarl Version

n\a

OS

Debian

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@s3v- s3v- added the bug label Dec 29, 2022
@webknjaz
Copy link
Member

Looks like there was a change in how the stdlib behaves. The question is why. We need to see the upstream patch and the motivation behind it.

@s3v-
Copy link
Author

s3v- commented Jan 4, 2023

This is the relevant commit:
python/cpython@72d356e

Thanks for your work.

@webknjaz
Copy link
Member

webknjaz commented Jan 4, 2023

Aha! So it's not a bug in that patch but in our test. I suppose that it's easy to fix it by moving 37 away from the beginning of the scheme? I wonder what is the purpose of the test...

@s3v-
Copy link
Author

s3v- commented Jan 7, 2023

yarl parsing is coherent with new behavior of urlsplit for Python 3.11.

Python 3.11.1 (main, Dec 31 2022, 10:23:59) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from yarl import URL
>>> url = URL('37signals:book')
>>> url.scheme
''
>>> url.path
'37signals:book'
>>> 

I think failing test just need to be adapted to python 3.11 like test_no_scheme1 did for different Python versions.

Kind Regards

@webknjaz
Copy link
Member

Fixed by #810.

@mcepl
Copy link

mcepl commented Mar 2, 2023

This will actually happen with all Python interpreters patched against CVE-2023-24329 (see python/cpython#102153).

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

3 participants