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 <carljm@instagram.com>
This commit is contained in:
Carl Meyer 2022-10-10 03:59:07 +02:00 committed by GitHub
parent fc342c62e0
commit ad817cd5c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -1582,7 +1582,7 @@ class FTPHandler(BaseHandler):
headers = email.message_from_string(headers)
return addinfourl(fp, headers, req.full_url)
except ftplib.all_errors as exp:
raise URLError(f'ftp error: {exp}') from exp
raise URLError(exp) from exp
def connect_ftp(self, user, passwd, host, port, dirs, timeout):
return ftpwrapper(user, passwd, host, port, dirs, timeout,