Skip to content

Commit fc20596

Browse files
committed
Use except/else for parsedate_to_datetime exception handling
1 parent 1e68be9 commit fc20596

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Lib/http/server.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,8 @@ def send_head(self):
699699
self.headers["If-Modified-Since"])
700700
except (TypeError, IndexError, OverflowError, ValueError):
701701
# ignore ill-formed values
702-
ims = None
703-
if ims is not None:
702+
pass
703+
else:
704704
if ims.tzinfo is None:
705705
# obsolete format with no timezone, cf.
706706
# https://tools.ietf.org/html/rfc7231#section-7.1.1.1
@@ -1243,4 +1243,3 @@ def test(HandlerClass=BaseHTTPRequestHandler,
12431243
else:
12441244
handler_class = SimpleHTTPRequestHandler
12451245
test(HandlerClass=handler_class, port=args.port, bind=args.bind)
1246-

0 commit comments

Comments
 (0)