summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/urllib/request.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 6da9007..5cf0cf2 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -2240,7 +2240,11 @@ class ftpwrapper:
self.timeout = timeout
self.refcount = 0
self.keepalive = persistent
- self.init()
+ try:
+ self.init()
+ except:
+ self.close()
+ raise
def init(self):
import ftplib