mirror of
https://github.com/python/cpython.git
synced 2024-11-30 13:24:13 +08:00
(issue 17452 / ftplib) fix TypeError occurring in case ssl module is not installed
This commit is contained in:
parent
0351928359
commit
a77d7a52e8
@ -440,7 +440,7 @@ class FTP:
|
|||||||
break
|
break
|
||||||
callback(data)
|
callback(data)
|
||||||
# shutdown ssl layer
|
# shutdown ssl layer
|
||||||
if isinstance(conn, _SSLSocket):
|
if _SSLSocket is not None and isinstance(conn, _SSLSocket):
|
||||||
conn.unwrap()
|
conn.unwrap()
|
||||||
return self.voidresp()
|
return self.voidresp()
|
||||||
|
|
||||||
@ -473,7 +473,7 @@ class FTP:
|
|||||||
line = line[:-1]
|
line = line[:-1]
|
||||||
callback(line)
|
callback(line)
|
||||||
# shutdown ssl layer
|
# shutdown ssl layer
|
||||||
if isinstance(conn, _SSLSocket):
|
if _SSLSocket is not None and isinstance(conn, _SSLSocket):
|
||||||
conn.unwrap()
|
conn.unwrap()
|
||||||
return self.voidresp()
|
return self.voidresp()
|
||||||
|
|
||||||
@ -502,7 +502,7 @@ class FTP:
|
|||||||
if callback:
|
if callback:
|
||||||
callback(buf)
|
callback(buf)
|
||||||
# shutdown ssl layer
|
# shutdown ssl layer
|
||||||
if isinstance(conn, _SSLSocket):
|
if _SSLSocket is not None and isinstance(conn, _SSLSocket):
|
||||||
conn.unwrap()
|
conn.unwrap()
|
||||||
return self.voidresp()
|
return self.voidresp()
|
||||||
|
|
||||||
@ -531,7 +531,7 @@ class FTP:
|
|||||||
if callback:
|
if callback:
|
||||||
callback(buf)
|
callback(buf)
|
||||||
# shutdown ssl layer
|
# shutdown ssl layer
|
||||||
if isinstance(conn, _SSLSocket):
|
if _SSLSocket is not None and isinstance(conn, _SSLSocket):
|
||||||
conn.unwrap()
|
conn.unwrap()
|
||||||
return self.voidresp()
|
return self.voidresp()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user