From 63bc51d73d873087278780738ad6bd78a48a440c Mon Sep 17 00:00:00 2001 From: sobolevn Date: Tue, 24 Oct 2023 12:21:04 +0300 Subject: [PATCH 1/2] gh-111253: Fix socketmodule.c not checking for errors when initializing --- .../Library/2023-10-24-12-20-46.gh-issue-111253.HFywSK.rst | 1 + Modules/socketmodule.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2023-10-24-12-20-46.gh-issue-111253.HFywSK.rst diff --git a/Misc/NEWS.d/next/Library/2023-10-24-12-20-46.gh-issue-111253.HFywSK.rst b/Misc/NEWS.d/next/Library/2023-10-24-12-20-46.gh-issue-111253.HFywSK.rst new file mode 100644 index 00000000000000..2671b899dfa4d5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-10-24-12-20-46.gh-issue-111253.HFywSK.rst @@ -0,0 +1 @@ +Fix ``_socket`` module not checking for errors when initializing. diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 3d099d41d1e761..ddc18d845616fa 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -7723,10 +7723,10 @@ socket_exec(PyObject *m) /* FreeBSD divert(4) */ #ifdef PF_DIVERT - PyModule_AddIntMacro(m, PF_DIVERT); + ADD_INT_MACRO(m, PF_DIVERT); #endif #ifdef AF_DIVERT - PyModule_AddIntMacro(m, AF_DIVERT); + ADD_INT_MACRO(m, AF_DIVERT); #endif #ifdef AF_PACKET From 69502aa436e4f66b6f65093e6e5c5fd571569e3c Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Wed, 25 Oct 2023 08:42:49 +0200 Subject: [PATCH 2/2] Adjust NEWS entry --- .../next/Library/2023-10-24-12-20-46.gh-issue-111253.HFywSK.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2023-10-24-12-20-46.gh-issue-111253.HFywSK.rst b/Misc/NEWS.d/next/Library/2023-10-24-12-20-46.gh-issue-111253.HFywSK.rst index 2671b899dfa4d5..e21a42605aeaf6 100644 --- a/Misc/NEWS.d/next/Library/2023-10-24-12-20-46.gh-issue-111253.HFywSK.rst +++ b/Misc/NEWS.d/next/Library/2023-10-24-12-20-46.gh-issue-111253.HFywSK.rst @@ -1 +1 @@ -Fix ``_socket`` module not checking for errors when initializing. +Add error checking during :mod:`!_socket` module init.