Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Doc/library/http.cookies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ The character set, :data:`string.ascii_letters`, :data:`string.digits` and
in a cookie name (as :attr:`~Morsel.key`).

.. versionchanged:: 3.3
Allowed ':' as a valid cookie name character.
Allowed '``:``' as a valid cookie name character.

.. versionchanged:: next
Allowed '``"``' as a valid cookie value character.

.. note::

Expand Down Expand Up @@ -314,3 +316,10 @@ The following example demonstrates how to use the :mod:`http.cookies` module.
>>> print(C)
Set-Cookie: number=7
Set-Cookie: string=seven
>>> import json
>>> C = cookies.SimpleCookie()
>>> C.load(f'cookies=7; mixins="{json.dumps({"chips": "dark chocolate"})}"; state=gooey')
>>> print(C)
Set-Cookie: cookies=7
Set-Cookie: mixins="{"chips": "dark chocolate"}"
Set-Cookie: state=gooey
8 changes: 8 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,14 @@ http.client
(Contributed by Alexander Enrique Urieles Nieto in :gh:`131724`.)


http.cookies
------------

* Allow '``"``' double quotes in cookie values with a more lenient regex for
double-quoted strings.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Allow '``"``' double quotes in cookie values with a more lenient regex for
double-quoted strings.
* Allow '``"``' double quotes in cookie values with a more lenient regex for
double-quoted strings by not explicitly excluding a quote inside the value part of a cookie.

It's pretty similar to what was there before, just doesn't exclude the quotes: https://github.com/python/cpython/pull/113663/files#diff-e49aab1421911b035542d1a9221c31b8c74053f0e8b28f90f03af66177026176R429

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is becoming little too detailed for a whatsnew item. Since it is both a bugfix and behavior change (ref #137566 (comment))

We could say - "Allow '"' double quotes in cookie values" or the existing detail is fine with me.

@AA-Turner, what is your suggestion here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I'm a fan of the shorter

"Allow '"' double quotes in cookie values"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am good with the shorter version too. It is clear without confusing on the internal details like lenient regex (which the reader of whatsnew doc doesn't need to bother about) and if they really want they could refer to git log, bug report and other discussions.

(Contributed by Nick Burns and Senthil Kumaran in :gh:`92936`.)


math
----

Expand Down
Loading