Skip to content

Commit 7e113ba

Browse files
committed
Use if block instead of ternary for port fallback
1 parent 5628773 commit 7e113ba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Lib/http/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,10 @@ def __init__(self, host, port=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
917917
self._create_connection = socket.create_connection
918918

919919
def __repr__(self):
920-
port = self.port if self.port is not None else self.default_port
920+
if self.port is not None:
921+
port = self.port
922+
else:
923+
port = self.default_port
921924
return f'<{self.__class__.__name__} {self.host}:{port}>'
922925

923926
def set_tunnel(self, host, port=None, headers=None):

0 commit comments

Comments
 (0)