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>
This commit is contained in:
Nathaniel J. Smith 2023-05-08 16:27:20 -07:00 committed by GitHub
parent 4541d1a0db
commit faf196213e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -0,0 +1 @@
:func:`socket.getnameinfo` now releases the GIL while contacting the DNS server

View File

@ -6883,8 +6883,10 @@ socket_getnameinfo(PyObject *self, PyObject *args)
} }
#endif #endif
} }
Py_BEGIN_ALLOW_THREADS
error = getnameinfo(res->ai_addr, (socklen_t) res->ai_addrlen, error = getnameinfo(res->ai_addr, (socklen_t) res->ai_addrlen,
hbuf, sizeof(hbuf), pbuf, sizeof(pbuf), flags); hbuf, sizeof(hbuf), pbuf, sizeof(pbuf), flags);
Py_END_ALLOW_THREADS
if (error) { if (error) {
socket_state *state = get_module_state(self); socket_state *state = get_module_state(self);
set_gaierror(state, error); set_gaierror(state, error);