Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 031f1e6 commit 615b24cCopy full SHA for 615b24c
3 files changed
Lib/http/cookiejar.py
@@ -1224,14 +1224,9 @@ def path_return_ok(self, path, request):
1224
_debug(" %s does not path-match %s", req_path, path)
1225
return False
1226
1227
-def vals_sorted_by_key(adict):
1228
- keys = sorted(adict.keys())
1229
- return map(adict.get, keys)
1230
-
1231
def deepvalues(mapping):
1232
- """Iterates over nested mapping, depth-first, in sorted order by key."""
1233
- values = vals_sorted_by_key(mapping)
1234
- for obj in values:
+ """Iterates over nested mapping, depth-first"""
+ for obj in list(mapping.values()):
1235
mapping = False
1236
try:
1237
obj.items
Lib/test/test_http_cookiejar.py
@@ -1293,11 +1293,11 @@ def test_Cookie_iterator(self):
1293
r'port="90,100, 80,8080"; '
1294
r'max-age=100; Comment = "Just kidding! (\"|\\\\) "')
1295
1296
- versions = [1, 1, 1, 0, 1]
1297
- names = ["bang", "foo", "foo", "spam", "foo"]
1298
- domains = [".sol.no", "blah.spam.org", "www.acme.com",
1299
- "www.acme.com", "www.acme.com"]
1300
- paths = ["/", "/", "/", "/blah", "/blah/"]
+ versions = [1, 0, 1, 1, 1]
+ names = ["foo", "spam", "foo", "foo", "bang"]
+ domains = ["blah.spam.org", "www.acme.com", "www.acme.com",
+ "www.acme.com", ".sol.no"]
+ paths = ["/", "/blah", "/blah/", "/", "/"]
1301
1302
for i in range(4):
1303
i = 0
Misc/NEWS.d/next/Library/2020-10-19-08-50-41.bpo-42066.DsB-R6.rst
@@ -0,0 +1,2 @@
1
+Fix cookies getting sorted in :func:`CookieJar.__iter__` which is an extra behavior and not mentioned in RFC 2965 or Netscape cookie protocol.
2
+Now the cookies in ``CookieJar`` follows the order of the ``Set-Cookie`` header. Patch by Iman Kermani.
0 commit comments