-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-127090: Fix urllib.response.addinfourl.url
value for opened file:
URIs
#127091
base: main
Are you sure you want to change the base?
Conversation
The original `file:` URL that was passed to `urlopen()` is now used as the `url` attribute of the returned `addinfourl` object. The `addinfourl.url` attribute *always* reflects the original `file:`, `data:` or `ftp:` URL now.
urllib.request.addinfourl.url
value for opened file:
URIsurllib.response.addinfourl.url
value for opened file:
URIs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general, but there are not enough tests.
I think that you can add checks for url
in test_file_notexists
and maybe in test_basic
and test_copy
in urlretrieve_FileTests
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Serhiy, that's very helpful. I'll mark this PR as a draft for now. Once #127125 and #127194 land, I'll adjust this patch to call |
The original
file:
URL that was passed tourlopen()
is now used as theurl
attribute of the returnedaddinfourl
object. Theaddinfourl.url
attribute always reflects the originalfile:
,data:
orftp:
URL now.