Skip to content

Commit 528d651

Browse files
committed
Fix possibly-used-before-assignment violations
1 parent 096fc22 commit 528d651

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

cheroot/server.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ def get(self, *args, **kwargs):
161161
IS_UID_GID_RESOLVABLE = False
162162
grp, pwd = None, None
163163
import struct
164+
else:
165+
grp, pwd, struct = None, None, None
164166

165167

166168
if IS_WINDOWS and hasattr(socket, 'AF_INET6'):
@@ -249,6 +251,7 @@ def __call__(self, rfile, hdict=None): # noqa: C901 # FIXME
249251
if hdict is None:
250252
hdict = {}
251253

254+
hname = None
252255
while True:
253256
line = rfile.readline()
254257
if not line:

cheroot/test/test_ssl.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,16 +730,18 @@ def test_http_over_https_error(
730730
104,
731731
'Connection reset by peer',
732732
)
733-
if IS_MACOS:
733+
elif IS_MACOS:
734734
expected_error_code, expected_error_text = (
735735
54,
736736
'Connection reset by peer',
737737
)
738-
if IS_WINDOWS:
738+
elif IS_WINDOWS:
739739
expected_error_code, expected_error_text = (
740740
10054,
741741
'An existing connection was forcibly closed by the remote host',
742742
)
743+
else:
744+
assert False # pragma: no cover
743745

744746
underlying_error = ssl_err.value.args[0].args[-1]
745747
err_text = str(underlying_error)

cheroot/workers/threadpool.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@ def stop(self, timeout=5):
367367

368368
if timeout is not None:
369369
endtime = time.time() + timeout
370+
else:
371+
endtime = float('inf')
370372

371373
# Must shut down threads here so the code that calls
372374
# this method can know when all threads are stopped.

0 commit comments

Comments
 (0)