Issue30204
Created on 2017-04-29 08:23 by giampaolo.rodola, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg292576 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * ![]() |
Date: 2017-04-29 08:23 | |
This caused me a lot of headaches (broken test) before figuring out what the heck was wrong: =) >>> import socket >>> s = socket.socket() >>> s.type <SocketKind.SOCK_STREAM: 1> >>> s.setblocking(0) >>> s.type 2049 >>> s.setblocking(1) >>> s.type <SocketKind.SOCK_STREAM: 1> getsockopt() on the other hand always tells the truth: >>> s.getsockopt(socket.SOL_SOCKET, socket.SO_TYPE) 1 ...so I suppose we can do that in the "type" property of the Python socket class. It appears the type is set in socket init: https://github.com/python/cpython/blob/1e2147b9d75a64df370a9393c2b5b9d170dc0afd/Modules/socketmodule.c#L904 ...and it's changed later in setblocking: https://github.com/python/cpython/blob/1e2147b9d75a64df370a9393c2b5b9d170dc0afd/Modules/socketmodule.c#L609 |
|||
| msg292587 - (view) | Author: Martin Panter (martin.panter) * ![]() |
Date: 2017-04-29 09:26 | |
Is this a duplicate of Issue 21327? There is some discussion there and a patch to add get_socket_type that excludes SOCK_NONBLOCK. |
|||
| msg292588 - (view) | Author: Giampaolo Rodola' (giampaolo.rodola) * ![]() |
Date: 2017-04-29 09:31 | |
Woo! I completely forgot I already bumped into this and that I even filed a ticket for it. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:45 | admin | set | github: 74390 |
| 2017-04-29 09:31:34 | giampaolo.rodola | set | status: open -> closed resolution: duplicate messages: + msg292588 stage: resolved |
| 2017-04-29 09:26:53 | martin.panter | set | superseder: socket.type value changes after using settimeout() messages:
+ msg292587 |
| 2017-04-29 08:23:43 | giampaolo.rodola | create | |
