Skip to content

Commit

Permalink
GH-104308: socket.getnameinfo should release the GIL (#104307)
Browse files Browse the repository at this point in the history
* socket.getnameinfo should release the GIL

* πŸ“œπŸ€– Added by blurb_it.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
  • Loading branch information
njsmith and blurb-it[bot] authored May 8, 2023
1 parent 4541d1a commit faf1962
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:func:`socket.getnameinfo` now releases the GIL while contacting the DNS server
2 changes: 2 additions & 0 deletions Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -6883,8 +6883,10 @@ socket_getnameinfo(PyObject *self, PyObject *args)
}
#endif
}
Py_BEGIN_ALLOW_THREADS
error = getnameinfo(res->ai_addr, (socklen_t) res->ai_addrlen,
hbuf, sizeof(hbuf), pbuf, sizeof(pbuf), flags);
Py_END_ALLOW_THREADS
if (error) {
socket_state *state = get_module_state(self);
set_gaierror(state, error);
Expand Down

0 comments on commit faf1962

Please sign in to comment.