Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 05eb401

Browse files
author
Skip Montanaro
committed
Fix indentation error in testGetServByName and rewrite loop to avoid clumsy
sentinel variable
1 parent 029dba5 commit 05eb401

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

Lib/test/test_socket.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,22 +273,19 @@ def testNtoH(self):
273273
def testGetServByName(self):
274274
# Testing getservbyname()
275275
# try a few protocols - not everyone has telnet enabled
276-
found = 0
277276
for proto in ("telnet", "ssh", "www", "ftp"):
278277
try:
279278
socket.getservbyname(proto, 'tcp')
280-
found = 1
281279
break
282280
except socket.error:
283281
pass
284282
try:
285283
socket.getservbyname(proto, 'udp')
286-
found = 1
287284
break
288285
except socket.error:
289286
pass
290-
if not found:
291-
raise socket.error
287+
else:
288+
raise socket.error
292289

293290
def testDefaultTimeout(self):
294291
# Testing default timeout

0 commit comments

Comments
 (0)