diff --git a/src/python/jw/pkg/lib/Uri.py b/src/python/jw/pkg/lib/Uri.py index 6c299b31..cada582e 100644 --- a/src/python/jw/pkg/lib/Uri.py +++ b/src/python/jw/pkg/lib/Uri.py @@ -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