Skip to content

gh-89057: Allow HTTP request logging when stderr is unavailable - #159335

Open
esadomer wants to merge 1 commit into
python:mainfrom
esadomer:fix-20261013-06-http-server-no-stderr
Open

esadomer wants to merge 1 commit into
python:mainfrom
esadomer:fix-20261013-06-http-server-no-stderr

Conversation

@esadomer

@esadomer esadomer commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

BaseHTTPRequestHandler.log_message() raises when sys.stderr is None, interrupting request handling. Skip the write while still clearing per-request logging state. Cover successful and unsupported requests and logging after stderr is restored.

Fixes #89057.

Validation (Windows debug build): test_httpservers passed (104 tests run, 8 skipped); the new request cases reproduced the failure before the fix. The isolated patch applies cleanly to the base revision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP request handler: check sys.stderr != None before logging

1 participant