1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-09-07 21:58:41 +02:00

Fix Password.encode() on python < 3.8

This commit is contained in:
2024-01-22 16:28:28 +01:00
parent 3d7f79b706
commit 0413179709
2 changed files with 23 additions and 0 deletions

View File

@@ -119,6 +119,12 @@ class Password(collections.UserString):
return f"{self.__str__():{format_spec}}"
return super().__format__(format_spec)
def encode(self, *args, **kwargs):
if sys.version_info < (3, 8):
# avoid returning the Password object on python < 3.8
return str(self).encode(*args, **kwargs)
return super().encode(*args, **kwargs)
HttpHeader = NewType("HttpHeader", Tuple[str, str])