diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2019-12-04 09:29:10 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@python.org> | 2019-12-04 09:29:10 (GMT) |
commit | 24f5cac7254177a4c9956d680c0a9b6dadd85c6f (patch) | |
tree | 4981a516ece7ac9ce58e6736ede5a8c43e35a3fb /Lib/test | |
parent | edd5b38c137db82e2857242518fcc400e9b5a9c1 (diff) | |
download | cpython-24f5cac7254177a4c9956d680c0a9b6dadd85c6f.zip cpython-24f5cac7254177a4c9956d680c0a9b6dadd85c6f.tar.gz cpython-24f5cac7254177a4c9956d680c0a9b6dadd85c6f.tar.bz2 |
bpo-38962: Fix reference leak in test_httpservers (GH-17454)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_httpservers.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index 26da71e..c442f55 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -807,11 +807,15 @@ class CGIHTTPServerTestCase(BaseTestCase): (res.read(), res.getheader('Content-type'), res.status)) def test_cgi_path_in_sub_directories(self): - CGIHTTPRequestHandler.cgi_directories.append('/sub/dir/cgi-bin') - res = self.request('/sub/dir/cgi-bin/file5.py') - self.assertEqual( - (b'Hello World' + self.linesep, 'text/html', HTTPStatus.OK), - (res.read(), res.getheader('Content-type'), res.status)) + try: + CGIHTTPRequestHandler.cgi_directories.append('/sub/dir/cgi-bin') + res = self.request('/sub/dir/cgi-bin/file5.py') + self.assertEqual( + (b'Hello World' + self.linesep, 'text/html', HTTPStatus.OK), + (res.read(), res.getheader('Content-type'), res.status)) + finally: + CGIHTTPRequestHandler.cgi_directories.remove('/sub/dir/cgi-bin') + class SocketlessRequestHandler(SimpleHTTPRequestHandler): |