-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Release 2.2.1 #3345
Release 2.2.1 #3345
Conversation
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.
Thanks @pquentin!
Confirmed current tip of |
Having looked more closely at #3203, I see two ways to avoid using diff --git a/src/urllib3/_request_methods.py b/src/urllib3/_request_methods.py
index 632042f0..49495c3e 100644
--- a/src/urllib3/_request_methods.py
+++ b/src/urllib3/_request_methods.py
@@ -122,8 +122,8 @@ class RequestMethods:
headers = self.headers
if not ("content-type" in map(str.lower, headers.keys())):
- headers = HTTPHeaderDict(headers)
- headers["Content-Type"] = "application/json"
+ headers = headers.copy() # type: ignore[attr-defined]
+ headers["Content-Type"] = "application/json" # type: ignore[index]
body = _json.dumps(json, separators=(",", ":"), ensure_ascii=False).encode(
"utf-8" But I would like less ignores, not more. The other option, suggested in python/mypy#5970, is to accept that headers can indeed be immutable given the diff --git a/src/urllib3/_request_methods.py b/src/urllib3/_request_methods.py
index 632042f0..f08b69e8 100644
--- a/src/urllib3/_request_methods.py
+++ b/src/urllib3/_request_methods.py
@@ -122,6 +122,13 @@ class RequestMethods:
headers = self.headers
if not ("content-type" in map(str.lower, headers.keys())):
+ # While headers is most likely dict or HTTPHeaderDict, it can
+ # also be an arbitrary immutable mapping that will stay
+ # immutable even after calling copy().
+ if isinstance(headers, HTTPHeaderDict):
+ headers = headers.copy()
+ else:
+ headers = dict(headers)
headers = HTTPHeaderDict(headers)
headers["Content-Type"] = "application/json" But this is more complicated code for a case that we don't care about (immutable headers object that is not dict or In summary, given that:
I'd like to release 2.2.1 as is. |
Release <VERSION>
"<REMOTE>
accordingly)<VERSION>
shouldn't have av
prefix (Use1.26.6
instead ofv.1.26.6
)publish
GitHub workflow. This requires a review from a maintainer.be one
.whl
, one.tar.gz
, and onemultiple.intoto.jsonl
. Update the GitHubrelease to have the content of the release's changelog.
If this was a 1.26.x release, add changelog to themain
branch