-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat: add partitioned attribute to cookie #2501
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
Conversation
|
Closing this since |
|
@Kludex can we keep this open as draft like python/cpython#112714 in the meantime? |
|
I prefer to keep it closed for organization. When that is merged, we can continue the work here. |
wait for Kludex/starlette#2501 or equivalent
|
The CPython PR is merged now (targeted at 3.14 as far as I can tell). Can this be reopened or do we need a new PR? |
I'd be happy if this is reopened :) |
@Flecart , wish granted 😅 . I guess conflicts could be resolved here so this can move forward? |
Sry for the delay, coming! |
Old message 10 Feb 2024: the test should fail, we need to wait for python/cpython#112713 Current update: 17 Apr 2025: It was merged, so it should be ok.
|
Hello people, This is a breaking change, I currently do not know a cleaner version other than checking the version we are in currently, if you have better ways, that'll be well accepted. Ifrunning set cookie for python version earlier than 3.14 just returns an error like: def __setitem__(self, K, V):
K = K.lower()
if not K in self._reserved:
> raise CookieError("Invalid attribute %r" % (K,))
E http.cookies.CookieError: Invalid attribute 'partitioned'I have tested locally, it passes tests with python version 3.14.0a7, and returns that error for python 3.11.8 |
style: run linter fix: compatible with 3.13 fix: use partition test only for higher versions
There is a problem with the coverage, sometimes it is not compatible with python versions, some code should not be executed for some python versions, and coverage is not able to handle this thing well
|
Hello people. |
|
@Kludex reminder to check this when you have time. Thank you very much! |
docs/responses.md
Outdated
| * `secure` - A bool indicating that the cookie will only be sent to the server if request is made using SSL and the HTTPS protocol. `Optional` | ||
| * `httponly` - A bool indicating that the cookie cannot be accessed via JavaScript through `Document.cookie` property, the `XMLHttpRequest` or `Request` APIs. `Optional` | ||
| * `samesite` - A string that specifies the samesite strategy for the cookie. Valid values are `'lax'`, `'strict'` and `'none'`. Defaults to `'lax'`. `Optional` | ||
| * `partitioned` - A bool indicates to user agents that these cross-site cookies should only be available in the same top-level context that the cookie was first set in. `Optional` |
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.
We should mention that it's only available on Python 3.14+.
Summary
Added the
partitionedattribute.See #2500.
Checklist
Why was this draft?
Wait for python/cpython#112714 to get merged. (it was merged in Jan 2025)