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
Fix the popitem bug in cookies #6192
base: main
Are you sure you want to change the base?
Conversation
jar.set("1st_key", "1st_value") | ||
jar.set("2nd_key", "2nd_value") | ||
cookie = next(iter(jar)) | ||
assert jar.popitem() == (cookie, cookie.value) |
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.
Can you add an assertion of what the jar looks like afterwards, I think __delitem__
needs a fix also?
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.
Can you also add a test for when cookie.name is not unique in the jar, eg different values for cookie.domain and cookie.path
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.
Good call @graingert , __delitem__
had the same problem.
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.
It looks like popitem will delete multiple items instead of just one, can you add a test for that?
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.
Yes but it's because of remove_cookie_by_name
. I don't know what can be done about it without breaking its main functionality.
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.
This one has been stuck for a long time. Do you have any suggestions for the remove_cookie_by_name
problem?
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.
You can implement popitem directly instead of editing __delitem__
and __getitem__
2fd8d11
to
8749d26
Compare
Closes #6190