Skip to content

Commit c08ea28

Browse files
committed
Remove a structure used for compatbility with Python 2.4
Python 2.4 is no longer anywhere close to supported so we can put `except` and `finally` in the same `try` block now.
1 parent 2674d56 commit c08ea28

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

pytest_localserver/smtp.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,13 @@ def main():
166166
print("Type <Ctrl-C> to stop")
167167

168168
try:
169-
170-
try:
171-
while True:
172-
time.sleep(1)
173-
finally:
174-
print("\rstopping...")
175-
server.stop()
176-
169+
while True:
170+
time.sleep(1)
177171
except KeyboardInterrupt:
178-
# support for Python 2.4 dictates that try ... finally is not used
179-
# together with any except statements
180172
pass
173+
finally:
174+
print("\rstopping...")
175+
server.stop()
181176

182177

183178
if __name__ == "__main__": # pragma: no cover

0 commit comments

Comments
 (0)