From 6890a1ac7775eef2a9f08e0a03950bfd76a8593c Mon Sep 17 00:00:00 2001 From: Geoffrey Thomas Date: Thu, 22 Jul 2021 00:50:55 -0400 Subject: [PATCH 1/2] bpo-44751: Move crypt.h include from public header to _cryptmodule --- Include/Python.h | 13 ------------- .../C API/2021-07-27-17-29-12.bpo-44751.4qmbDG.rst | 2 ++ Modules/_cryptmodule.c | 3 +++ 3 files changed, 5 insertions(+), 13 deletions(-) create mode 100644 Misc/NEWS.d/next/C API/2021-07-27-17-29-12.bpo-44751.4qmbDG.rst diff --git a/Include/Python.h b/Include/Python.h index 4d0335d3c52c36..a05c37e211c1fb 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -35,19 +35,6 @@ #ifndef MS_WINDOWS #include #endif -#ifdef HAVE_CRYPT_H -#if defined(HAVE_CRYPT_R) && !defined(_GNU_SOURCE) -/* Required for glibc to expose the crypt_r() function prototype. */ -# define _GNU_SOURCE -# define _Py_GNU_SOURCE_FOR_CRYPT -#endif -#include -#ifdef _Py_GNU_SOURCE_FOR_CRYPT -/* Don't leak the _GNU_SOURCE define to other headers. */ -# undef _GNU_SOURCE -# undef _Py_GNU_SOURCE_FOR_CRYPT -#endif -#endif /* For size_t? */ #ifdef HAVE_STDDEF_H diff --git a/Misc/NEWS.d/next/C API/2021-07-27-17-29-12.bpo-44751.4qmbDG.rst b/Misc/NEWS.d/next/C API/2021-07-27-17-29-12.bpo-44751.4qmbDG.rst new file mode 100644 index 00000000000000..c64b71247b7359 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2021-07-27-17-29-12.bpo-44751.4qmbDG.rst @@ -0,0 +1,2 @@ +Remove crypt.h include from the public Python.h header and move it to +_cryptmodule.c, which is the only file that needs it. diff --git a/Modules/_cryptmodule.c b/Modules/_cryptmodule.c index a95f55a63c306e..72a4f44600d92c 100644 --- a/Modules/_cryptmodule.c +++ b/Modules/_cryptmodule.c @@ -4,6 +4,9 @@ #include "Python.h" #include +#ifdef HAVE_CRYPT_H +#include +#endif /* Module crypt */ From 5eba578b94a154dd1da1a0151b7d5895234b9a22 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 27 Jul 2021 15:11:10 -0700 Subject: [PATCH 2/2] formatting and concision --- .../NEWS.d/next/C API/2021-07-27-17-29-12.bpo-44751.4qmbDG.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Misc/NEWS.d/next/C API/2021-07-27-17-29-12.bpo-44751.4qmbDG.rst b/Misc/NEWS.d/next/C API/2021-07-27-17-29-12.bpo-44751.4qmbDG.rst index c64b71247b7359..d7b9f098196694 100644 --- a/Misc/NEWS.d/next/C API/2021-07-27-17-29-12.bpo-44751.4qmbDG.rst +++ b/Misc/NEWS.d/next/C API/2021-07-27-17-29-12.bpo-44751.4qmbDG.rst @@ -1,2 +1 @@ -Remove crypt.h include from the public Python.h header and move it to -_cryptmodule.c, which is the only file that needs it. +Remove ``crypt.h`` include from the public ``Python.h`` header.