Skip to content

Commit ad817cd

Browse files
carljmCarl Meyer
and
Carl Meyer
authored
bpo-43564: preserve original exception in args of FTP URLError (#24938)
* bpo-43564: preserve original error in args of FTP URLError * Add NEWS blurb Co-authored-by: Carl Meyer <[email protected]>
1 parent fc342c6 commit ad817cd

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Lib/urllib/request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1582,7 +1582,7 @@ def ftp_open(self, req):
15821582
headers = email.message_from_string(headers)
15831583
return addinfourl(fp, headers, req.full_url)
15841584
except ftplib.all_errors as exp:
1585-
raise URLError(f'ftp error: {exp}') from exp
1585+
raise URLError(exp) from exp
15861586

15871587
def connect_ftp(self, user, passwd, host, port, dirs, timeout):
15881588
return ftpwrapper(user, passwd, host, port, dirs, timeout,
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Wrap network errors consistently in urllib FTP support, so the test suite
2+
doesn't fail when a network is available but the public internet is not
3+
reachable.

0 commit comments

Comments
 (0)