Please confirm the following
Describe the bug
I'm building yarl 1.22.0 in Fedora Linux 45 with Python 3.15.0a6.
Two tests fail. Based on the traceback, this will have something to do with the changes to urllib.parse: python/cpython@c5cfcdf
I don't know if it's regression on the side of Python or a functionality that needs to be worked into yarl's code.
Happy to test any fixes.
To Reproduce
in a fresh venv with Python 3.15.0a6:
$ python -m pip install pytest pytest_cov -e .
$ python -m pytest tests/test_pickle.py -W ignore::DeprecationWarning # needed because current pygments leaks a DeprecationWarning
Expected behavior
Tests pass
Logs/tracebacks
_________________________________ test_pickle __________________________________
[gw0] linux -- Python 3.15.0 /usr/bin/python3
def test_pickle() -> None:
u1 = URL("picklepickle")
hash(u1)
> v = pickle.dumps(u1)
^^^^^^^^^^^^^^^^
u1 = URL('picklepickle')
tests/test_pickle.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = SplitResult(scheme='', netloc='', path='picklepickle', query='', fragment='')
def __getstate__(self):
state = super().__getstate__()
try:
> if state[1]['_keep_empty'] == _MISSING_AS_NONE_DEFAULT:
^^^^^^^^
E TypeError: 'NoneType' object is not subscriptable
E when serializing tuple item 0
E when serializing yarl.URL state
E when serializing yarl.URL object
__class__ = <class 'urllib.parse._ResultBase'>
self = SplitResult(scheme='', netloc='', path='picklepickle', query='', fragment='')
state = None
/usr/lib64/python3.15/urllib/parse.py:311: TypeError
______________________ test_pickle_does_not_pollute_cache ______________________
[gw0] linux -- Python 3.15.0 /usr/bin/python3
def test_pickle_does_not_pollute_cache() -> None:
"""Verify the unpickling does not pollute the cache.
Since unpickle will call URL.__new__ with default
args, we need to make sure that default args never
end up in the pre_encoded_url or encode_url cache.
"""
u1 = URL.__new__(URL)
u1._scheme = "this"
u1._netloc = "never.appears.any.where.else.in.tests"
u1._path = ""
u1._query = ""
u1._fragment = ""
hash(u1)
> v = pickle.dumps(u1)
^^^^^^^^^^^^^^^^
u1 = URL('this://never.appears.any.where.else.in.tests')
tests/test_pickle.py:48:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = SplitResult(scheme='this', netloc='never.appears.any.where.else.in.tests', path='', query='', fragment='')
def __getstate__(self):
state = super().__getstate__()
try:
> if state[1]['_keep_empty'] == _MISSING_AS_NONE_DEFAULT:
^^^^^^^^
E TypeError: 'NoneType' object is not subscriptable
E when serializing tuple item 0
E when serializing yarl.URL state
E when serializing yarl.URL object
__class__ = <class 'urllib.parse._ResultBase'>
self = SplitResult(scheme='this', netloc='never.appears.any.where.else.in.tests', path='', query='', fragment='')
state = None
Python Version
$ python --version
3.15.0a6
multidict Version
$ python -m pip show multidict
Version: 6.7.1
propcache Version
$ python -m pip show propcache
yarl Version
$ python -m pip show yarl
Version: 1.23.0 (tested on today's master)
OS
Fedora Linux 45/43
Additional context
No response
Please confirm the following
vulnerability, to the best of my knowledge. (These must be shared by
submitting this report form instead, if
any hesitation exists.)
Describe the bug
I'm building yarl 1.22.0 in Fedora Linux 45 with Python 3.15.0a6.
Two tests fail. Based on the traceback, this will have something to do with the changes to urllib.parse: python/cpython@c5cfcdf
I don't know if it's regression on the side of Python or a functionality that needs to be worked into yarl's code.
Happy to test any fixes.
To Reproduce
in a fresh venv with Python 3.15.0a6:
Expected behavior
Tests pass
Logs/tracebacks
_________________________________ test_pickle __________________________________ [gw0] linux -- Python 3.15.0 /usr/bin/python3 def test_pickle() -> None: u1 = URL("picklepickle") hash(u1) > v = pickle.dumps(u1) ^^^^^^^^^^^^^^^^ u1 = URL('picklepickle') tests/test_pickle.py:11: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = SplitResult(scheme='', netloc='', path='picklepickle', query='', fragment='') def __getstate__(self): state = super().__getstate__() try: > if state[1]['_keep_empty'] == _MISSING_AS_NONE_DEFAULT: ^^^^^^^^ E TypeError: 'NoneType' object is not subscriptable E when serializing tuple item 0 E when serializing yarl.URL state E when serializing yarl.URL object __class__ = <class 'urllib.parse._ResultBase'> self = SplitResult(scheme='', netloc='', path='picklepickle', query='', fragment='') state = None /usr/lib64/python3.15/urllib/parse.py:311: TypeError ______________________ test_pickle_does_not_pollute_cache ______________________ [gw0] linux -- Python 3.15.0 /usr/bin/python3 def test_pickle_does_not_pollute_cache() -> None: """Verify the unpickling does not pollute the cache. Since unpickle will call URL.__new__ with default args, we need to make sure that default args never end up in the pre_encoded_url or encode_url cache. """ u1 = URL.__new__(URL) u1._scheme = "this" u1._netloc = "never.appears.any.where.else.in.tests" u1._path = "" u1._query = "" u1._fragment = "" hash(u1) > v = pickle.dumps(u1) ^^^^^^^^^^^^^^^^ u1 = URL('this://never.appears.any.where.else.in.tests') tests/test_pickle.py:48: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = SplitResult(scheme='this', netloc='never.appears.any.where.else.in.tests', path='', query='', fragment='') def __getstate__(self): state = super().__getstate__() try: > if state[1]['_keep_empty'] == _MISSING_AS_NONE_DEFAULT: ^^^^^^^^ E TypeError: 'NoneType' object is not subscriptable E when serializing tuple item 0 E when serializing yarl.URL state E when serializing yarl.URL object __class__ = <class 'urllib.parse._ResultBase'> self = SplitResult(scheme='this', netloc='never.appears.any.where.else.in.tests', path='', query='', fragment='') state = NonePython Version
multidict Version
propcache Version
$ python -m pip show propcacheyarl Version
OS
Fedora Linux 45/43
Additional context
No response