[issue36686] Docs: asyncio.loop.subprocess_exec documentation is confusing, it's not clear how to inherit stdin, stdout or stderr in the subprocess
Change by Simon Bernier St-Pierre : -- keywords: +patch pull_requests: +13493 stage: -> patch review pull_request: https://github.com/python/cpython/pull/13586 ___ Python tracker <https://bugs.python.org/issue36686> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36686] Docs: asyncio.loop.subprocess_exec documentation is confusing, it's not clear how to inherit stdin, stdout or stderr in the subprocess
Change by Simon Bernier St-Pierre : -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue36686> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue30957] pathlib: Path and PurePath cannot be subclassed
New submission from Simon Bernier St-Pierre: Because of the special way Path and PurePath are instantiated, they can't be inherited like a normal class. Here's an example of the issue: >>> import pathlib >>> class MyPath(pathlib.Path): ... pass ... >>> p = MyPath('/home') Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.5/pathlib.py", line 969, in __new__ self = cls._from_parts(args, init=False) File "/usr/lib/python3.5/pathlib.py", line 651, in _from_parts drv, root, parts = self._parse_args(args) File "/usr/lib/python3.5/pathlib.py", line 644, in _parse_args return cls._flavour.parse_parts(parts) AttributeError: type object 'MyPath' has no attribute '_flavour' A solution is to get the concrete type of Path via type(Path()) and inherit the class it yields, but it isn't pretty or intuitive. Perhaps a declaration that directs to the proper class could be added to the module. PlatformPath = WindowsPath if os.name == 'nt' else PosixPath PurePlatformPath = ... -- components: Library (Lib) messages: 298577 nosy: Simon Bernier St-Pierre priority: normal severity: normal status: open title: pathlib: Path and PurePath cannot be subclassed type: enhancement versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <http://bugs.python.org/issue30957> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36686] Docs: asyncio.loop.subprocess_exec documentation is confusing, it's not clear how to inherit stdin, stdout or stderr in the subprocess
New submission from Simon Bernier St-Pierre : I had trouble figuring out how to simply inherit stdin, stdout, or stderr in the asyncio.create_subprocess_exec / asyncio.subprocess_exec docs. My experiments show that passing either None or `sys.std*` works but the way the docs are written make it hard to figure that out in my opinion. > stdout: either a file-like object representing the pipe to be connected to > the subprocess’s standard output stream using connect_read_pipe(), or the > subprocess.PIPE constant (default). By default a new pipe will be created and > connected. I would add a mention that using None makes the subprocess inherit the file descriptor. -- components: asyncio messages: 340593 nosy: asvetlov, sbstp, yselivanov priority: normal severity: normal status: open title: Docs: asyncio.loop.subprocess_exec documentation is confusing, it's not clear how to inherit stdin, stdout or stderr in the subprocess versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue36686> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36687] subprocess encoding
Change by Simon Bernier St-Pierre : -- nosy: sbstp priority: normal severity: normal status: open title: subprocess encoding ___ Python tracker <https://bugs.python.org/issue36687> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36687] subprocess encoding
Change by Simon Bernier St-Pierre : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue36687> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue36686] Docs: asyncio.loop.subprocess_exec documentation is confusing, it's not clear how to inherit stdin, stdout or stderr in the subprocess
Simon Bernier St-Pierre added the comment: Could be cool to also mention that `encoding` / `errors` does not work yet. https://bugs.python.org/issue31087 -- ___ Python tracker <https://bugs.python.org/issue36686> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26395] asyncio does not support yielding from recvfrom (socket/udp)
New submission from Simon Bernier St-Pierre: I want to receive data on a UDP socket that was bound, without blocking the event loop. I've looked through the asyncio docs, and I haven't found a way of doing that using the coroutine API (yield from/await). There is a sock_recv method on BaseEventLoop which is a coroutine, it seems like sock_recvfrom was never implemented. I don't have a patch for this right now, I wanted to know what people thought of adding support for this. -- components: asyncio messages: 260580 nosy: Simon Bernier St-Pierre, gvanrossum, haypo, yselivanov priority: normal severity: normal status: open title: asyncio does not support yielding from recvfrom (socket/udp) versions: Python 3.5 ___ Python tracker <http://bugs.python.org/issue26395> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26395] asyncio does not support yielding from recvfrom (socket/udp)
Simon Bernier St-Pierre added the comment: That could work. I came up with this class MyProtocol(aio.DatagramProtocol): def __init__(self, fut): self._fut = fut def datagram_received(self, data, addr): self.fut.set_result((data, addr)) fut = aio.Future() loop.create_datagram_endpoint(lambda: MyProtocol(fut), ...) yield from fut 1. Is there a better way of sharing the future between the protocol and the main function? 2. This might be inefficient because I have to create a new endpoint every time I want to receive a packet. I might be able to implement a scheme where I give the protocol a new future after every packet, but it's kind of cumbersome. If I wrote the patch to make sock_recvfrom work, can it get merged or must it go through the PEP process? -- ___ Python tracker <http://bugs.python.org/issue26395> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26395] asyncio does not support yielding from recvfrom (socket/udp)
Simon Bernier St-Pierre added the comment: I want to have a loop that receives data like this: socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) socket.bind(('0.0.0.0', port)) socket.setblocking(False) while True: data, addr = await loop.sock_recvfrom(sock, 4096) # process packet It's pretty similar to what the blocking code would look like, but it allows me to keep everything on a single thread without blocking. It could be done with the Protocol API, but I'd rather use the shiny new async/await API. -- ___ Python tracker <http://bugs.python.org/issue26395> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26395] asyncio does not support yielding from recvfrom (socket/udp)
Simon Bernier St-Pierre added the comment: I created a patch for it on the asyncio github repo. https://github.com/python/asyncio/pull/321 -- ___ Python tracker <http://bugs.python.org/issue26395> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26395] asyncio does not support yielding from recvfrom (socket/udp)
Changes by Simon Bernier St-Pierre : -- status: open -> closed ___ Python tracker <http://bugs.python.org/issue26395> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com