From e6ae758ba65107cc6323cafe49a22e97da74baf3 Mon Sep 17 00:00:00 2001 From: "Nathaniel J. Smith" Date: Mon, 8 May 2023 16:27:20 -0700 Subject: [PATCH] GH-104308: socket.getnameinfo should release the GIL (GH-104307) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * socket.getnameinfo should release the GIL * 📜🤖 Added by blurb_it. --------- (cherry picked from commit faf196213e60d8a90773e9e5680d3252bd294643) Co-authored-by: Nathaniel J. Smith Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> --- .../next/Library/2023-05-08-20-57-17.gh-issue-104307.DSB93G.rst | 1 + Modules/socketmodule.c | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2023-05-08-20-57-17.gh-issue-104307.DSB93G.rst 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 index 00000000000000..03775845450caa --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-05-08-20-57-17.gh-issue-104307.DSB93G.rst @@ -0,0 +1 @@ +:func:`socket.getnameinfo` now releases the GIL while contacting the DNS server diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 0e319a4cfd383b..47539d354b49a6 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -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; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy