-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
gh-123503: Replace usages of addinfourl and HTTPResponse deprecated attributes with stable ones #132670
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
base: main
Are you sure you want to change the base?
Conversation
Please, don't re-create your PRs. Next time, just ask if there is some issue with git and I'll try helping you. |
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.
I would say "yes, let's do this", but I honestly want a second opinion on this change. We can always revert it later during the beta if this causes issues, though.
Misc/NEWS.d/next/Library/2025-04-18-04-47-39.gh-issue-123503.mfg0wD.rst
Outdated
Show resolved
Hide resolved
…fg0wD.rst Co-authored-by: Bénédikt Tran <[email protected]>
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. 👍
Misc/NEWS.d/next/Library/2025-04-18-04-47-39.gh-issue-123503.mfg0wD.rst
Outdated
Show resolved
Hide resolved
…fg0wD.rst Co-authored-by: Martin Panter <[email protected]>
I don’t understand what you mean by “while retaining backwards compatibility”. Why are you changing the test suite? There doesn’t seem to be any consideration given to existing user code, such as the caching class in the bug report. Does this change break code that implements code but not status? Does it break code implementing info but not headers? Before 3.9, only HTTP and HTTPS responses had the status attribute, and headers was not documented while info was. I winder if we at least need documentation saying what changes a user needs to remain compatible with the changes in Python. Maybe also fall back to the old attribute and method as well? This is the problem with deprecating two-way APIs that are implemented in both user code and Python. |
Mmh, I see your point. You mean that "what if someone coming from something before 3.9 is now trying to port stuff to Python 3.14"? I'd say that anything marked as being deprecated should also be changed on their side but I guess it doesn't hurt having a paragraph in "Porting to 3.14".
Strictly speaking, yes. But I wouldn't consider this as being critical as the attribute has been marked as deprecated since 3.9. And any class that inherits from
I'd say it's the same as above. That being said, we're already using "possible missing" attributes in, for instance, xmlrpc: try:
http_conn = self.send_request(host, handler, request_body, verbose)
resp = http_conn.getresponse()
if resp.status == 200:
self.verbose = verbose
return self.parse_response(resp) OTOH, for
So we should already be on the safe side. But OTOH, the changes to other occurrences may indeed break stuff, though I wouldn't consider this as being critical, especially if it's something that's been deprecated since 3.9. In the original report, what was actually annoying was more that users need to provide the deprecated attributes as well. So I think it's better to move forwards, at the cost of possibly breaking APIs that use deprecated attributes. Now, if you want to be on the safe side, how about adding a true DeprecationWarning, without any removal plans, and implement a fallback logic if needs arise? |
I replaced deprecated features with the recommended current features(updated to the latest version)
HTTPErrorProcessor
uses deprecated members ofaddinfourl
/HTTPResponse
#123503