]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] GH-104308: socket.getnameinfo should release the GIL (GH-104307) (#104313)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 8 May 2023 23:49:45 +0000 (16:49 -0700)
committerGitHub <noreply@github.com>
Mon, 8 May 2023 23:49:45 +0000 (23:49 +0000)
GH-104308: socket.getnameinfo should release the GIL (GH-104307)

* socket.getnameinfo should release the GIL

* ðŸ“œðŸ¤– Added by blurb_it.

---------

(cherry picked from commit faf196213e60d8a90773e9e5680d3252bd294643)

Co-authored-by: Nathaniel J. Smith <njs@pobox.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Misc/NEWS.d/next/Library/2023-05-08-20-57-17.gh-issue-104307.DSB93G.rst [new file with mode: 0644]
Modules/socketmodule.c

diff --git a/Misc/NEWS.d/next/Library/2023-05-08-20-57-17.gh-issue-104307.DSB93G.rst b/Misc/NEWS.d/next/Library/2023-05-08-20-57-17.gh-issue-104307.DSB93G.rst
new file mode 100644 (file)
index 0000000..0377584
--- /dev/null
@@ -0,0 +1 @@
+:func:`socket.getnameinfo` now releases the GIL while contacting the DNS server
index 0e319a4cfd383bad345772f58f2adfda4970ee6d..47539d354b49a6e2d39cbf29627147b90340c1aa 100644 (file)
@@ -6737,8 +6737,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) {
         set_gaierror(error);
         goto fail;