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

Skip to content

Commit 2ad2569

Browse files
committed
Initialize msg to avoid unbound locals.
1 parent 7d9ed72 commit 2ad2569

5 files changed

Lines changed: 6 additions & 0 deletions

File tree

Lib/ftplib.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def connect(self, host = '', port = 0):
115115
if host: self.host = host
116116
if port: self.port = port
117117
self.passiveserver = 0
118+
msg = "getaddrinfo returns an empty list"
118119
for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM):
119120
af, socktype, proto, canonname, sa = res
120121
try:
@@ -270,6 +271,7 @@ def sendeprt(self, host, port):
270271

271272
def makeport(self):
272273
'''Create a new socket and send a PORT command for it.'''
274+
msg = "getaddrinfo returns an empty list"
273275
for res in socket.getaddrinfo(None, 0, self.af, socket.SOCK_STREAM, 0, socket.AI_PASSIVE):
274276
af, socktype, proto, canonname, sa = res
275277
try:

Lib/httplib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ def set_debuglevel(self, level):
357357

358358
def connect(self):
359359
"""Connect to the host and port specified in __init__."""
360+
msg = "getaddrinfo returns an empty list"
360361
for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM):
361362
af, socktype, proto, canonname, sa = res
362363
try:

Lib/poplib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class POP3:
7575
def __init__(self, host, port = POP3_PORT):
7676
self.host = host
7777
self.port = port
78+
msg = "getaddrinfo returns an empty list"
7879
for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM):
7980
af, socktype, proto, canonname, sa = res
8081
try:

Lib/smtplib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ def connect(self, host='localhost', port = 0):
217217
raise socket.error, "nonnumeric port"
218218
if not port: port = SMTP_PORT
219219
if self.debuglevel > 0: print 'connect:', (host, port)
220+
msg = "getaddrinfo returns an empty list"
220221
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
221222
af, socktype, proto, canonname, sa = res
222223
try:

Lib/telnetlib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ def open(self, host, port=0):
136136
port = TELNET_PORT
137137
self.host = host
138138
self.port = port
139+
msg = "getaddrinfo returns an empty list"
139140
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
140141
af, socktype, proto, canonname, sa = res
141142
try:

0 commit comments

Comments
 (0)