Charles-François Natali added the comment:
Pipes cannot be configured in non-blocking mode on Windows. It sounds
dangerous to call a blocking syscall in a signal handler.
In fact, it works to write the signal number into a pipe on Windows, but I'm
worried about the blocking behaviour.
STINNER Victor added the comment:
2014-07-25 9:02 GMT+02:00 Charles-François Natali rep...@bugs.python.org:
Pipes cannot be configured in non-blocking mode on Windows. It sounds
dangerous to call a blocking syscall in a signal handler.
In fact, it works to write the signal number into a
Charles-François Natali added the comment:
In the issue #22042, I would like to make automatically the file desscriptor
or socket handler in non-blocking mode. The problem is that you cannot make a
file descriptor in non-blocking mode on Windows.
I don't think we should set it non-blocking
STINNER Victor added the comment:
Charles-François wrote:
I don't think we should set it non-blocking automatically, but rather
check that it's non-blocking.
The first reason I can think of is that the user passing a blocking FD
could be a sign of a bug (e.g. if the other end is in blocking
Charles-François Natali added the comment:
It doesn't answer to my complain: I don't want to support file descriptors on
Windows anymore because file descriptors cannot be configured in non-blocking
mode.
I think it does : if an exception is raised if an FD/handler is not in
non-blocking
STINNER Victor added the comment:
I don't understand this. If you're ok with calling fileno() under Linux, why
not under Windows?
I propose to add set_wakeup_socket() for all platforms. This function doesn't
really call the fileno() method, it gets the socket file descriptor/socket
handle
Antoine Pitrou added the comment:
Le 24/07/2014 06:00, STINNER Victor a écrit :
STINNER Victor added the comment:
I don't understand this. If you're ok with calling fileno() under Linux, why
not under Windows?
I propose to add set_wakeup_socket() for all platforms.
That's not what I'm
STINNER Victor added the comment:
That's not what I'm answering to, though. See option B above.
Again, what's wrong with passing the socket as a fileno?
There is nothing wrong, it's just that I prefer option (C) over the option
(B).
Quick poll in the Python stdlib for functions accepting
Charles-François Natali added the comment:
As I said offline to Victor, I think it would be better to have a single
function, i.e. keep set_wakeup_fd(). It makes the API simpler, less confusing
and error prone: some people will wonder which one they should use, might end
up using the wrong
Guido van Rossum added the comment:
I find Charles' argument pretty convincing. The whole point of this API is to
have another thing you can add to the selector to deal with a race condition.
You then pass this thing's fileno() to signal.set_wakeup_fd(). That should be
totally portable.
I'm
STINNER Victor added the comment:
Ok, let's go with the option (B): use set_wakeup_fd() on all platforms, but
only accept socket handles on Windows.
New patch wakeup_fd-7.patch:
- signal.set_wakeup_fd() now only accepts socket handles (int) on Windows, it
raises TypeError for files. Note: it
Guido van Rossum added the comment:
I think if it's not a socket (or a closed one) it should raise ValueError or
perhaps OSError -- TypeError would mean that it's not an int.
--
___
Python tracker rep...@bugs.python.org
STINNER Victor added the comment:
I think if it's not a socket (or a closed one) it should raise ValueError or
perhaps OSError -- TypeError would mean that it's not an int.
Oh, you're right. Updated patch, version 8, now raises a ValueError.
--
Added file:
Charles-François Natali added the comment:
Ok, let's go with the option (B): use set_wakeup_fd() on all platforms, but
only accept socket handles on Windows.
Sorry, why restrict it to sockets on Windows?
If someone wants to pass e.g. a pipe, why prevent it?
--
STINNER Victor added the comment:
Sorry, why restrict it to sockets on Windows?
If someone wants to pass e.g. a pipe, why prevent it?
Pipes cannot be configured in non-blocking mode on Windows. It sounds dangerous
to call a blocking syscall in a signal handler.
In fact, it works to write
Antoine Pitrou added the comment:
In fact, it works to write the signal number into a pipe on Windows, but I'm
worried about the blocking behaviour.
It wasn't different before, so I'm not sure why we should start to worry about
it?
--
___
Python
STINNER Victor added the comment:
In fact, it works to write the signal number into a pipe on Windows, but I'm
worried about the blocking behaviour.
It wasn't different before, so I'm not sure why we should start to worry
about it?
Does you have an idea if set_wakeup_fd() is used on
Roundup Robot added the comment:
New changeset 5ce01ee2a8f4 by Victor Stinner in branch 'default':
Issue #22018: Fix test_set_wakeup_fd_result(), use assertEqual() not
http://hg.python.org/cpython/rev/5ce01ee2a8f4
--
___
Python tracker
STINNER Victor added the comment:
Does you have an idea if set_wakeup_fd() is used on Windows? It's not
possible to use it with select.select() because on Windows this function only
accepts sockets. I don't know if it's possible to watch a pipe using IOCP. Is
set_wakeup_fd() used by
STINNER Victor added the comment:
Windows only supports non-blocking mode for sockets. IMO we should only support
sockets on Windows. I opened the issue #22042 which proposes to change
signal.set_wakeup_fd(fd) to automatically make the file descriptor
non-blocking. I cannot implement it on
STINNER Victor added the comment:
Windows only supports non-blocking mode for sockets. IMO we should only support
sockets on Windows. I opened the issue #22042 which proposes to change
signal.set_wakeup_fd(fd) to automatically make the file descriptor
non-blocking. I cannot implement it on
Changes by STINNER Victor victor.stin...@gmail.com:
--
Removed message: http://bugs.python.org/msg223793
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22018
___
Antoine Pitrou added the comment:
I don't like the option (B). Sockets are usually stored as objects
(socket.socket) because of Windows, not as socket handle (int)
I don't understand this. If you're ok with calling fileno() under Linux, why
not under Windows?
--
STINNER Victor added the comment:
New patch to rebase the code and document the new function. It fixed also the
docstring.
--
Added file: http://bugs.python.org/file36033/signal_socket-3.patch
___
Python tracker rep...@bugs.python.org
STINNER Victor added the comment:
I talked with Charles-François. He doesn't like the idea of a new function
because it would be harder to write portable code: which function should be
used? signal.set_wakeup_fd() already works with sockets on UNIX.
Here is a new patch version 4 which tries
STINNER Victor added the comment:
I tried to modify signal.set_wakeup_socket() to automatically make the file
descriptor non-blocking. Problem: fcntl() function and O_NONBLOCK flag don't
exist on Windows. Non-blocking operations are only supported for sockets...
Calling a blocking function
Changes by STINNER Victor victor.stin...@gmail.com:
--
title: signal: accept socket for signal.set_wakeup_fd() - Add a new
signal.set_wakeup_socket() function
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22018
Roundup Robot added the comment:
New changeset 7a1737033a23 by Victor Stinner in branch 'default':
Issue #22018: Hum, set_wakeup_fd() still raises ValueError on Windows
http://hg.python.org/cpython/rev/7a1737033a23
--
___
Python tracker
28 matches
Mail list logo