Kind of a tangled mess, but now logging works in both Python 2 and 3.
no-check-commit because of the interface required by Python's HTTP
server code.
yuja |
hg-reviewers |
Kind of a tangled mess, but now logging works in both Python 2 and 3.
server code.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
I'm not crazy about not logging bytes everywhere. Why is the file-like object taking bytes in Python 2 but Unicode in Python 3? It feels like you stumbled onto an existing bug where the logging mechanism isn't encoding aware?
The file-like object to which we're logging is always in bytes mode - we traffic in unicodes from the callsite of log_error and log_request because there's lots of internal wsgi bits that are unicodes, and it's easier to make the log template a native string and bounce it down to bytes on Python 3 than to try and wrap the entire WSGI universe in a bytes blanket. Does that clarify things?
mercurial/hgweb/server.py | ||
---|---|---|
340 | Replaced this with encoding.strtolocal() since socket.error may |
Replaced this with encoding.strtolocal() since socket.error may
contain platform-native string.