py3: work around weird handling of bytes/unicode in decode_header()
Basically decode_header() works as follows, and on Python 3, email headers
ARE UNICODE.
def decode_header(header):
if not ecre.search(header): # ecre is unicode regexp
return [(header, None)] # so header is unicode string
... decode header into [(bytes_data, unicode_charset_name)]
return collapsed
py3: fix string issues of email message in test-import.t
- payload can be bytes
- headers must be unicode on Python 3
- need to call msg.as_bytes() on Python 3, but msg.as_string() on Python 2,
where bytes(msg) magic works
procutil: drop unused 'newlines' option from popen*() (API)
It's unlikely for us to use the universal_newlines option.
procutil: make explainexit() simply return a message (API)
Almost all callers want it.
procutil: do not convert return code of signal exit to positive number (API)
The docstring states that "codes from kill are negative", and it doesn't
make sense to make exit/signal code ambiguous.
.. api::
``hook.hook()`` and ``hook.runhooks()`` may return a negative integer
to denote that the process was killed by signal.
procutil: fix error message of tempfile filter
First, we need to use procutil.system() to get an exit code compatible with
explainexit(). Second, explainexit() returns (msg, code) tuple.
procutil: unify platform.explainexit()
Since
4368f582c806 "use subprocess instead of os.system", posix.explainexit()
is the superset of Windows implementation.