Skip to content

Commit faf1962

Browse files
GH-104308: socket.getnameinfo should release the GIL (#104307)
* socket.getnameinfo should release the GIL * 📜🤖 Added by blurb_it. --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
1 parent 4541d1a commit faf1962

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:func:`socket.getnameinfo` now releases the GIL while contacting the DNS server

Modules/socketmodule.c

+2
Original file line numberDiff line numberDiff line change
@@ -6883,8 +6883,10 @@ socket_getnameinfo(PyObject *self, PyObject *args)
68836883
}
68846884
#endif
68856885
}
6886+
Py_BEGIN_ALLOW_THREADS
68866887
error = getnameinfo(res->ai_addr, (socklen_t) res->ai_addrlen,
68876888
hbuf, sizeof(hbuf), pbuf, sizeof(pbuf), flags);
6889+
Py_END_ALLOW_THREADS
68886890
if (error) {
68896891
socket_state *state = get_module_state(self);
68906892
set_gaierror(state, error);

0 commit comments

Comments
 (0)