This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [Patch] Don't require presence of POLLPRI
Type: Stage:
Components: Extension Modules Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: EdSchouten, benjamin.peterson
Priority: normal Keywords: patch

Created on 2016-07-30 14:30 by EdSchouten, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
pollpri.diff EdSchouten, 2016-07-30 14:30 Patch to make POLLPRI optional review
Messages (5)
msg271689 - (view) Author: Ed Schouten (EdSchouten) * Date: 2016-07-30 14:30
RFC 6093 states that applications "SHOULD NOT" make use of TCP's out-of-band data. For this reason, CloudABI (https://mail.python.org/pipermail/python-dev/2016-July/145708.html) does not provide support for it. This means that its poll() function does provide support for POLLIN and POLLOUT, but not for POLLPRI.

Attached is a patch that patches up the selectmodule to not define POLLPRI in case the host environment does not support it.
msg271805 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2016-08-02 05:45
Why do you remove the flag rather than just making it a noop?
msg271807 - (view) Author: Ed Schouten (EdSchouten) * Date: 2016-08-02 06:29
That's a very good question. One of the goals of CloudABI's C library is to leave out definitions for things that are known not to work in the environment. For example, our <fcntl.h> doesn't contain open(), as with our security model (Capsicum), there is nothing meaningful that this function could do anyway. Though this may seem annoying, this actually saves us a lot of time by allowing us to very easily detect software that will break.

The same reasoning applies to POLLPRI here. We could in theory implement it as an event that simply never triggers, but then it would be nothing more than a convoluted way of letting your program get stuck indefinitely.

Also worth taking into account here: I understand why the selectmodule provides support for POLLPRI. It simply wants to expose the entire poll() interface into Python code, but I'd argue that we'd have to look at the bigger picture. Support for out-of-band data in Python is incomplete anyway. The socket module also doesn't provide a binding for sockatmark().
msg271809 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2016-08-02 06:41
Are you planning on sending us patches to make Python compile without open(2)? Putting #ifdef around various constants is one thing but it seems like this could become quite invasive.
msg271810 - (view) Author: Ed Schouten (EdSchouten) * Date: 2016-08-02 07:12
Believe it our not, dealing with the absence of those system calls is more contained than you'd think. What is pretty nice about Python is that (almost) all of the file system operations are performed through posixmodule.c. Most of the changes in that area are thus made to that source file (and configure.ac).

Furthermore, it looks like posixmodule.c can be simplified a lot. What makes it so incredibly complex right now is that it wants to fall back to non-at() operations in case no directory file descriptor is provided, which is not needed. If that would get fixed, we'd kill two birds with one stone: the code would get a lot simpler, while almost automatically gaining support for CloudABI. But let's save this discussion for a separate thread.
History
Date User Action Args
2022-04-11 14:58:34adminsetgithub: 71842
2016-08-02 07:12:50EdSchoutensetmessages: + msg271810
2016-08-02 06:41:38benjamin.petersonsetmessages: + msg271809
2016-08-02 06:29:05EdSchoutensetmessages: + msg271807
2016-08-02 05:45:02benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg271805
2016-07-30 14:30:54EdSchoutencreate