From 43e0004c3526af4c070c3210bb92c64d3c274057 Mon Sep 17 00:00:00 2001 From: bananu7 Date: Thu, 11 Jan 2018 12:09:26 +0100 Subject: [PATCH 1/2] bpo-28429 Fix ctypes import under grsec TPE --- Lib/ctypes/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py index 61467739886482..fdcba4bd0fc60f 100644 --- a/Lib/ctypes/__init__.py +++ b/Lib/ctypes/__init__.py @@ -270,7 +270,8 @@ def _reset_cache(): # function is needed for the unittests on Win64 to succeed. This MAY # be a compiler bug, since the problem occurs only when _ctypes is # compiled with the MS SDK compiler. Or an uninitialized variable? - CFUNCTYPE(c_int)(lambda: None) + if _os.name == "nt": + CFUNCTYPE(c_int)(lambda: None) def create_unicode_buffer(init, size=None): """create_unicode_buffer(aString) -> character array From 80208297b3f5378afc3f2c7a081a5912682be37d Mon Sep 17 00:00:00 2001 From: bananu7 Date: Thu, 11 Jan 2018 12:34:24 +0100 Subject: [PATCH 2/2] bpo-28429 Added NEWS.d entry --- .../Core and Builtins/2018-01-11-12-32-26.bpo-28429.GKMfVW.rst | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2018-01-11-12-32-26.bpo-28429.GKMfVW.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-01-11-12-32-26.bpo-28429.GKMfVW.rst b/Misc/NEWS.d/next/Core and Builtins/2018-01-11-12-32-26.bpo-28429.GKMfVW.rst new file mode 100644 index 00000000000000..97096b745ccd8d --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2018-01-11-12-32-26.bpo-28429.GKMfVW.rst @@ -0,0 +1,3 @@ +Added a check that only runs dummy function init in ctypes on windows, where +it's needed. This solves the problem with GRsecurity/SELinux complaining +about that and treating it as a memory violation.