BPO | [30204](https://bugs.python.org/issue30204) --- | :--- Nosy | @giampaolo, @vadmium Superseder | bpo-21327: socket.type value changes after using settimeout() *Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.* Show more details GitHub fields: ```python assignee = None closed_at = created_at = labels = ['3.7', 'library'] title = 'socket.setblocking(0) changes socket.type' updated_at = user = 'https://github.com/giampaolo' ``` bugs.python.org fields: ```python activity = actor = 'giampaolo.rodola' assignee = 'none' closed = True closed_date = closer = 'giampaolo.rodola' components = ['Library (Lib)'] creation = creator = 'giampaolo.rodola' dependencies = [] files = [] hgrepos = [] issue_num = 30204 keywords = [] message_count = 3.0 messages = ['292576', '292587', '292588'] nosy_count = 2.0 nosy_names = ['giampaolo.rodola', 'martin.panter'] pr_nums = [] priority = 'normal' resolution = 'duplicate' stage = 'resolved' status = 'closed' superseder = '21327' type = None url = 'https://bugs.python.org/issue30204' versions = ['Python 3.6', 'Python 3.7'] ```
Activity
giampaolo commentedon Apr 29, 2017
This caused me a lot of headaches (broken test) before figuring out what the heck was wrong: =)
getsockopt() on the other hand always tells the truth:
...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:
cpython/Modules/socketmodule.c
Line 904 in 1e2147b
...and it's changed later in setblocking:
cpython/Modules/socketmodule.c
Line 609 in 1e2147b
vadmium commentedon Apr 29, 2017
Is this a duplicate of bpo-21327? There is some discussion there and a patch to add get_socket_type that excludes SOCK_NONBLOCK.
giampaolo commentedon Apr 29, 2017
Woo! I completely forgot I already bumped into this and that I even filed a ticket for it.