Skip to content

Commit 3c20e8b

Browse files
[3.12] gh-127522: wsgiref: indicate that start_response objects should follow a specific protocol (GH-127525) (GH-130505)
(cherry picked from commit 39ba4b6) Co-authored-by: Bénédikt Tran <[email protected]>
1 parent da471d9 commit 3c20e8b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Doc/library/wsgiref.rst

+10-4
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ in type annotations.
119119
applications to set up dummy environments. It should NOT be used by actual WSGI
120120
servers or applications, since the data is fake!
121121

122-
Example usage::
122+
Example usage (see also :func:`~wsgiref.simple_server.demo_app`
123+
for another example)::
123124

124125
from wsgiref.util import setup_testing_defaults
125126
from wsgiref.simple_server import make_server
@@ -312,6 +313,8 @@ request. (E.g., using the :func:`shift_path_info` function from
312313
as :mod:`wsgiref.simple_server`) is able to run a simple WSGI application
313314
correctly.
314315

316+
The *start_response* callable should follow the :class:`.StartResponse` protocol.
317+
315318

316319
.. class:: WSGIServer(server_address, RequestHandlerClass)
317320

@@ -679,7 +682,9 @@ input, output, and error streams.
679682

680683
This method can access the current error using ``sys.exception()``,
681684
and should pass that information to *start_response* when calling it (as
682-
described in the "Error Handling" section of :pep:`3333`).
685+
described in the "Error Handling" section of :pep:`3333`). In particular,
686+
the *start_response* callable should follow the :class:`.StartResponse`
687+
protocol.
683688

684689
The default implementation just uses the :attr:`error_status`,
685690
:attr:`error_headers`, and :attr:`error_body` attributes to generate an output
@@ -781,7 +786,7 @@ in :pep:`3333`.
781786
.. versionadded:: 3.11
782787

783788

784-
.. class:: StartResponse()
789+
.. class:: StartResponse
785790

786791
A :class:`typing.Protocol` describing :pep:`start_response()
787792
<3333#the-start-response-callable>`
@@ -816,7 +821,8 @@ in :pep:`3333`.
816821
Examples
817822
--------
818823

819-
This is a working "Hello World" WSGI application::
824+
This is a working "Hello World" WSGI application, where the *start_response*
825+
callable should follow the :class:`.StartResponse` protocol::
820826

821827
"""
822828
Every WSGI application must have an application object - a callable

0 commit comments

Comments
 (0)