Skip to content
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

session_transaction fails because it's calling _update_cookies_from_response with missing arg headers #5107

Closed
hofrob opened this issue May 2, 2023 · 2 comments
Milestone

Comments

@hofrob
Copy link

hofrob commented May 2, 2023

I'm re-creating the bug using flask and pytest.

tests/test_session_tx.py

import flask


def test_session_tx():
    app = flask.Flask("test")
    app.config["SECRET_KEY"] = "foo"
    client = app.test_client()
    with client.session_transaction() as session:
        session["bar"] = "baz"
  • install flask, pytest: pip install flask==2.2.4 pytest
  • run pytest tests/test_session_tx.py
        if hasattr(self, "_update_cookies_from_response"):
>           self._update_cookies_from_response(
                ctx.request.host.partition(":")[0], resp.headers.getlist("Set-Cookie")
            )
E           TypeError: Client._update_cookies_from_response() missing 1 required positional argument: 'headers'

venv/lib/python3.11/site-packages/flask/testing.py:171: TypeError

Environment:

  • Python version: 3.11.2
  • Werkzeug version: 2.3.3
  • Flask: 2.2.4
@hofrob hofrob changed the title session_transaction fails when calling _update_cookies_from_response with missing headers session_transaction fails because it's calling _update_cookies_from_response with missing headers May 2, 2023
@hofrob hofrob changed the title session_transaction fails because it's calling _update_cookies_from_response with missing headers session_transaction fails because it's calling _update_cookies_from_response with missing arg headers May 2, 2023
@davidism davidism transferred this issue from pallets/werkzeug May 2, 2023
@davidism davidism added this to the 2.2.5 milestone May 2, 2023
@davidism
Copy link
Member

davidism commented May 2, 2023

I'll add compatibility back in a 2.2.5 release. However, note that you're on an unnsupported version of Flask. The best way to fix this is to upgrade to Flask>=2.3.2.

@hofrob
Copy link
Author

hofrob commented May 2, 2023

Ok, this was a bit too fast for my brain. This is a bug in flask 2.2.4. Sorry about that!

I will take a look at our dependencies later and see why we even get these incompatible packages.

@davidism davidism closed this as completed May 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants