Skip to content

Commit f07c204

Browse files
committed
Make a copy for __repr__
1 parent 70a2ff0 commit f07c204

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

ada_url/ada_adapter.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from copy import deepcopy
12
from enum import IntEnum
23
from typing import (
34
Dict,
@@ -271,11 +272,9 @@ def __str__(self):
271272
return self.href
272273

273274
def __repr__(self):
274-
password = self.password
275-
self.password = ''
276-
ret = f'<URL "{self.href}">'
277-
self.password = password
278-
return ret
275+
duplicate = deepcopy(self)
276+
duplicate.password = ''
277+
return f'<URL "{duplicate.href}">'
279278

280279
@staticmethod
281280
def can_parse(url: str, base: Optional[str] = None) -> bool:

0 commit comments

Comments
 (0)