[New-bugs-announce] [issue44894] HTTP request handler should check sys.stderr for None before use for logging

Xiaoling Bao report at bugs.python.org
Wed Aug 11 19:56:49 EDT 2021


New submission from Xiaoling Bao <xiaolingbao at google.com>:

This is about HTTP server library (found on Windows with python 3.9, not sure other platforms).

In file Lib\http\server.py, we define:
class BaseHTTPRequestHandler(...):
  def log_message(self, format, *args):
    sys.stderr.write(...)

In certain cases, sys.stderr could be None and thus this function call will throw exception. My use case: I created an XMLRPC server (SimpleXMLRPCRequestHandler derives from BaseHTTPRequestHandler) within a Windows service. I guess with that combination, sys.stderr will be None. When this issue happens, the client got empty response and not much error log for debugging.

I can upload sample source code files if needed.

----------
components: Library (Lib)
messages: 399423
nosy: xiaolingbao
priority: normal
severity: normal
status: open
title: HTTP request handler should check sys.stderr for None before use for logging
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44894>
_______________________________________


More information about the New-bugs-announce mailing list