[issue21327] socket.type value changes after using settimeout()

2018-05-29 Thread Yury Selivanov


Yury Selivanov  added the comment:

This issue is resolved in 3.7: https://bugs.python.org/issue32331

--
nosy: +yselivanov
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
superseder:  -> Fix socket.type on OSes with SOCK_NONBLOCK
type:  -> behavior

___
Python tracker 

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



[issue21327] socket.type value changes after using settimeout()

2015-07-21 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
nosy:  -ethan.furman

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



[issue21327] socket.type value changes after using settimeout()

2015-05-02 Thread R. David Murray

R. David Murray added the comment:

I added some review comments.

Something I don't understand: if settimeout sets NONBLOCK, and CLOEXEC is 
always set now, why does s=socket.socket() yield something whose type is 
SOCK_STREAM, while settimeout causes type to change?  I don't understand the 
relationship between SOCK_NONBLOCK and O_NONBLOCK, either.

Whoever came up with this API in linux was crazy, if you ask me.  On the other 
hand, having type return what it does is clearly correct, given that we are 
mirroring the C API.  Having a new sock_type attribute that provides the value 
without the extra flags makes sense in that context, IMO.

--

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



[issue21327] socket.type value changes after using settimeout()

2015-05-02 Thread R. David Murray

R. David Murray added the comment:

The behavior of s.type has changed in 3.5: it now behaves like the proposed new 
method behaves.  Looking at the source I can't figure out why this is so.  It 
doesn't seem as though it should be, but this needs to be sorted out before we 
can proceed.

--
nosy: +ethan.furman

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



[issue21327] socket.type value changes after using settimeout()

2015-05-02 Thread R. David Murray

R. David Murray added the comment:

Wait, I take it back.  I must have run the test incorrectly.

--

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



[issue21327] socket.type value changes after using settimeout()

2015-04-21 Thread Raúl Cumplido

Raúl Cumplido added the comment:

ping, any comment on the patch that was provided during the PyCon 2015 sprints?

--

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



[issue21327] socket.type value changes after using settimeout()

2015-04-16 Thread Raúl Cumplido

Raúl Cumplido added the comment:

Added new patch as per review comments.

--
Added file: http://bugs.python.org/file39069/21327.2.patch

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



[issue21327] socket.type value changes after using settimeout()

2015-04-15 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone jean-p...@clusterhq.com:


--
nosy:  -exarkun

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



[issue21327] socket.type value changes after using settimeout()

2015-04-14 Thread Raúl Cumplido

Raúl Cumplido added the comment:

Forget my previous comment. Done with Linux and had the initial behavior again:
 s = socket.socket()
 s.type
SocketType.SOCK_STREAM: 1
 s.settimeout(2)
 s.type
2049

--

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



[issue21327] socket.type value changes after using settimeout()

2015-04-14 Thread Raúl Cumplido

Raúl Cumplido added the comment:

While reproducing it I've seen that this has been already solved:
 sock = socket.socket(type=socket.SOCK_STREAM)
 sock.type
SocketKind.SOCK_STREAM: 1
 sock.settimeout(2)
 sock.type
SocketKind.SOCK_STREAM: 1
But the next is still not correct:
 sock = socket.socket(type=socket.SOCK_STREAM | socket.SOCK_NONBLOCK)
 sock.type
2049

--

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



[issue21327] socket.type value changes after using settimeout()

2015-04-14 Thread Raúl Cumplido

Raúl Cumplido added the comment:

after conversation with @r.david.murray I understand that we only want to 
return the type, not all the flags, so the function will return just the 
socket.SOCK_STREAM or socket.SOCK_DGRAM ...

--

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



[issue21327] socket.type value changes after using settimeout()

2015-04-14 Thread Raúl Cumplido

Raúl Cumplido added the comment:

@haypo Would you expect the new function to return a tuple?

i.e:
 socket.get_socket_type(sock)
(socket.SOCK_STREAM, socket.SOCK_NONBLOCK)
 socket.get_socket_type(sock2)
(socket.SOCK_STREAM,)

--
nosy: +raulcd

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



[issue21327] socket.type value changes after using settimeout()

2015-04-14 Thread Raúl Cumplido

Raúl Cumplido added the comment:

Added docs and test in the patch.

--
keywords: +patch
Added file: http://bugs.python.org/file39009/issue21327.patch

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



[issue21327] socket.type value changes after using settimeout()

2015-04-14 Thread Raúl Cumplido

Raúl Cumplido added the comment:

Added patch that solves issue, but I am not sure this is what you expect. If 
you think this is the expected behavior I will add docs and tests:
 sock = socket.socket(type=socket.SOCK_STREAM | socket.SOCK_NONBLOCK)
 sock.type
2049
 socket.get_socket_type(sock)
SocketKind.SOCK_STREAM: 1
 sock = socket.socket(type=socket.SOCK_STREAM | socket.SOCK_NONBLOCK 
 |socket.SOCK_CLOEXEC)
 sock.type
526337
 socket.get_socket_type(sock)
SocketKind.SOCK_STREAM: 1

--

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



[issue21327] socket.type value changes after using settimeout()

2015-04-14 Thread R. David Murray

R. David Murray added the comment:

If we were designing from scratch, that would be true.  But we are stuck with 
the behavior that we have, and cannot change it because we need to preserve 
backward compatibility.  This is why we need to make it a new method.

--

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



[issue21327] socket.type value changes after using settimeout()

2015-04-14 Thread Nina Zakharenko

Nina Zakharenko added the comment:

Maybe it would be better if the type property on socket had this behavior, 
rather than creating a new method.

--
nosy: +nnja

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



[issue21327] socket.type value changes after using settimeout()

2014-06-26 Thread Mark Lawrence

Changes by Mark Lawrence breamore...@yahoo.co.uk:


--
nosy:  -BreamoreBoy

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



[issue21327] socket.type value changes after using settimeout()

2014-04-22 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola':

 s = socket.socket()
 s.type
SocketType.SOCK_STREAM: 1
 s.settimeout(2)
 s.type
2049
 

I can reproduce this with Python 3.5, 3.4 and 3.3.
2.7 is not affected.

--
messages: 216999
nosy: giampaolo.rodola
priority: normal
severity: normal
status: open
title: socket.type value changes after using settimeout()
versions: Python 3.3, Python 3.4, Python 3.5

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



[issue21327] socket.type value changes after using settimeout()

2014-04-22 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

It seems this was introduced in issue 7523 / revision 12442ac3f7dd.

--
nosy: +pitrou

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



[issue21327] socket.type value changes after using settimeout()

2014-04-22 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
Removed message: http://bugs.python.org/msg217001

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



[issue21327] socket.type value changes after using settimeout()

2014-04-22 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

Generally speaking I think it's fine to have this behavior only if the socket 
object is instantiated like this:

 s = socket.socket(type=socket.SOCK_STREAM | socket.SOCK_NONBLOCK)
 s.type
2049

...but when it comes to using setblocking() I would not expect that to happen 
(it's not cross platform).
Sounds reasonable?

--
nosy: +BreamoreBoy, exarkun, lekma, nvetoshkin, r.david.murray

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



[issue21327] socket.type value changes after using settimeout()

2014-04-22 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

Generally speaking I think it's fine to have this behavior only if the socket 
object is instantiated like this:

 s = socket.socket(type=socket.SOCK_STREAM | socket.SOCK_NONBLOCK)
 s.type
2049

...but when it comes to using settimeout() I would not expect that to happen 
(it's not cross platform).
Sounds reasonable?

--

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



[issue21327] socket.type value changes after using settimeout()

2014-04-22 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I think distinguishing between the two situations would make the code yet more 
complicated (and fragile). It's a bit unfortunate that the `type` attribute has 
become a kitchen sink for disparate pieces of configuration.

The fact that you are the first to complain though it was introduced in 3.2 
does not make it very compelling to change the current behaviour, IMHO.

--
nosy: +haypo, neologix

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



[issue21327] socket.type value changes after using settimeout()

2014-04-22 Thread STINNER Victor

STINNER Victor added the comment:

I would prefer to add something to get the type without SOCK_NONBLOCK nor
SOCK_CLOEXEC. So new feature can only be added to Python 3.5. For older
Python versions, you can to filter manually, which is difficult because you
have yo check if SOCK_NONBLOCK and/or SOCK_CLOEXEC are available. You have
the same issue in the C language.

Anyway, all sockets are now created with SOCK_CLOEXEC since Python 3.4
because of the PEP 446 (cloexec).

We can add a new .sock_type attribute. Or .type could be an object with
attributes like: type (int/enum), cloexec, nonblock, etc.

Or simply a short helper method can be added. Ex:
socket.get_socket_type(sock) or socket.get_socket_type(sock.type).

--

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