lib.Uri: Fix stale cache in __new_with_path() #74
1 changed files with 4 additions and 3 deletions
|
|
@ -1,7 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import copy
|
||||
|
||||
from functools import cached_property
|
||||
from typing import TYPE_CHECKING, override
|
||||
|
||||
|
|
@ -149,7 +147,10 @@ class Uri:
|
|||
)
|
||||
|
||||
def __new_with_path(self, base: str, path: str) -> Self:
|
||||
ret = copy.deepcopy(self)
|
||||
# -- Build a fresh instance rather than copying self: a copy would
|
||||
# inherit computed cached_property values (e.g. __p, path, full),
|
||||
# which would go stale as soon as __string is replaced below.
|
||||
ret = object.__new__(type(self))
|
||||
ret.__string = base
|
||||
ret.__username = None
|
||||
ret.__password = None
|
||||
|
|
|
|||
Loading…
Reference in a new issue