From fe9db901b2446b047e537447ea5bad3d470b0f78 Mon Sep 17 00:00:00 2001
From: adder32 <x@arcticadder.net>
Date: Wed, 15 Nov 2023 02:00:24 +0100
Subject: gh-111995: Add getnameinfo extension flag (#111994)

Add getnameinfo extension NI_IDN flag.
---
 .../NEWS.d/next/Library/2023-11-14-16-31-59.gh-issue-111995.OoX8JJ.rst | 2 ++
 Modules/socketmodule.c                                                 | 3 +++
 2 files changed, 5 insertions(+)
 create mode 100644 Misc/NEWS.d/next/Library/2023-11-14-16-31-59.gh-issue-111995.OoX8JJ.rst

diff --git a/Misc/NEWS.d/next/Library/2023-11-14-16-31-59.gh-issue-111995.OoX8JJ.rst b/Misc/NEWS.d/next/Library/2023-11-14-16-31-59.gh-issue-111995.OoX8JJ.rst
new file mode 100644
index 0000000..773f620
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-11-14-16-31-59.gh-issue-111995.OoX8JJ.rst
@@ -0,0 +1,2 @@
+Added the ``NI_IDN`` constant to the :mod:`socket` module when present in C
+at build time for use with :func:`socket.getnameinfo`.
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 2e1a097..9ac2001 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -8803,6 +8803,9 @@ socket_exec(PyObject *m)
 #ifdef NI_DGRAM
     ADD_INT_MACRO(m, NI_DGRAM);
 #endif
+#ifdef NI_IDN
+    ADD_INT_MACRO(m, NI_IDN);
+#endif
 
     /* shutdown() parameters */
 #ifdef SHUT_RD
-- 
cgit v0.12

