[issue31087] asyncio.create_subprocess_* do not honor `encoding`

2018-04-11 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

@adampl: The first step is for someone (possibly you :-)) to write a patch and 
submit it as a PR against the Python master branch. Then once the actual change 
is figured out, we can have the discussion about which releases to backport it 
to.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31087] asyncio.create_subprocess_* do not honor `encoding`

2018-04-11 Thread Adam

Adam  added the comment:

It occurs both on Python 3.6 and 3.7 RC, so maybe it should be fixed in the 3.7 
release.

--
nosy: +adampl
type:  -> behavior
versions: +Python 3.7
Added file: https://bugs.python.org/file47531/asyncio_encoding_test.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31087] asyncio.create_subprocess_* do not honor `encoding`

2018-01-17 Thread Nathaniel Smith

Nathaniel Smith  added the comment:

Python's codecs already support partial decode, exactly to handle this kind of 
case. See codecs.getincremental{en,de}coder and

https://docs.python.org/3/library/codecs.html#incremental-encoding-and-decoding

--
nosy: +njs

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31087] asyncio.create_subprocess_* do not honor `encoding`

2018-01-17 Thread Dima Tisnek

Dima Tisnek  added the comment:

I'd love to see universal_newlines=True in asyncio.subprocess.

--
nosy: +Dima.Tisnek

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31087] asyncio.create_subprocess_* do not honor `encoding`

2017-07-30 Thread Alex

Changes by Alex :


--
components: +asyncio
nosy: +yselivanov
versions: +Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31087] asyncio.create_subprocess_* do not honor `encoding`

2017-07-30 Thread Alex

New submission from Alex:

Regardless of the value of `encoding`, StreamReaders returned for the 
`asyncio.subprocess.Process`'s `stdout` and `stderr` would be in binary mode.

import sys
import asyncio
import subprocess

async def main():
sp = await asyncio.create_subprocess_exec('ls', '-la',
  stdin=None,
  stdout=subprocess.PIPE,
  encoding='utf8')
await sp.wait()
data = await sp.stdout.read()
print(data)
print(isinstance(data, bytes))

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

There are two naive solutions:

- `create_subprocess_*` could explicitly raise when provided any `encoding` and 
`errors` (like it now does with `universal_newlines`).

- or implement encoding conversions for StreamReaders (and StreamWriters), and 
forward those.

Of course it would be better to have conversions, but I don't know how those 
will have to deal with decoding partially available data - e.g. returning in 
the middle of surrogate pair, or having only half a codepoint for UTF16. There 
should likely cache partial data to process at the next read, but this would 
require rewriting codecs to support partial decode... seems like it's not that 
easy :(

--
messages: 299537
nosy: toriningen
priority: normal
severity: normal
status: open
title: asyncio.create_subprocess_* do not honor `encoding`

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com