diff --git a/CHANGES/1642.bugfix.rst b/CHANGES/1642.bugfix.rst new file mode 100644 index 000000000..2eae40c7d --- /dev/null +++ b/CHANGES/1642.bugfix.rst @@ -0,0 +1 @@ +Fixed pickle compatibility with Python 3.15. -- by :user:`befeleme`. diff --git a/yarl/_url.py b/yarl/_url.py index 5a79fe1f8..07b633fe3 100644 --- a/yarl/_url.py +++ b/yarl/_url.py @@ -566,8 +566,8 @@ def __mod__(self, query: Query) -> "URL": def __bool__(self) -> bool: return bool(self._netloc or self._path or self._query or self._fragment) - def __getstate__(self) -> tuple[SplitResult]: - return (tuple.__new__(SplitResult, self._val),) + def __getstate__(self) -> tuple[SplitURLType]: + return (self._val,) def __setstate__( self, state: tuple[SplitURLType] | tuple[None, _InternalURLCache]