Debian Codegraph @

debian/patches/0004-Close-the-addinfourl-wrapper-in-test_stream.patch

raw
1 Description: Close the addinfourl wrapper in test_stream
2 test_python_issue_20007_b leaves the addinfourl it wraps around the fake
3 HTTPResponse unclosed, so the socket is only released when the object is
4 garbage collected, emitting a ResourceWarning at some arbitrary later
5 point in the run. Close it explicitly instead.
6 .
7 This replaces 0004-Ignore-ResourceWarning-with-Python-3.14.patch, which
8 handled the same leak from the other end by suppressing ResourceWarning
9 for every tokenizer test. Neither patch is needed to build against
10 pytest 9.1 and Python 3.14 -- the suite passes with both removed -- but
11 the leak itself is real and upstream has a fix pending.
12 Author: Dale Richards <[email protected]>
13 Origin: upstream, https://github.com/html5lib/html5lib-python/pull/591
14 Forwarded: https://github.com/html5lib/html5lib-python/pull/591
15 Last-Update: 2026-09-18
16 --- a/html5lib/tests/test_stream.py
17 +++ b/html5lib/tests/test_stream.py
18 @@ -208,9 +208,9 @@ def test_python_issue_20007_b():
19
20 source = http.client.HTTPResponse(FakeSocket())
21 source.begin()
22 - wrapped = urllib.response.addinfourl(source, source.msg, "http://example.com")
23 - stream = HTMLInputStream(wrapped)
24 - assert stream.charsUntil(" ") == "Text"
25 + with urllib.response.addinfourl(source, source.msg, "http://example.com") as wrapped:
26 + stream = HTMLInputStream(wrapped)
27 + assert stream.charsUntil(" ") == "Text"
28
29
30 @pytest.mark.parametrize("inp,num",