Skip to content

for werkzeug.exceptions.HTTPException.get_response, type signature and documentation disagree #3056

@glyph

Description

@glyph
from werkzeug.exceptions import HTTPException

e: HTTPException
reveal_type(e.get_response())
src/t.py:4:13: note: Revealed type is "werkzeug.sansio.response.Response"
Success: no issues found in 1 source file

This is surprising because the type import of "Response" and the reference to "Response" seem to be indicating the sansio Response, however, I think that Sphinx is resolving the name reference in some global namespace that gets clobbered, which then results in the actual rendered documentation referring to werkzeug.wrappers.Response.

The actual implementation does return a werkzeug.wrappers.Response and we have code in Klein that expects this to be the case, so I think that this was perhaps a case of jumbled intent?

In any case these should be made to agree.

Environment:

  • Python version: 3.13.5
  • Werkzeug version: 3.1.3 / 504a8c4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions