[Python-checkins] bpo-35523: Remove ctypes callback workaround (GH-11211)

Victor Stinner webhook-mailer at python.org
Tue Dec 18 08:47:31 EST 2018


https://github.com/python/cpython/commit/e6b247c8e524dbe5fc03b3492f628d0d5348bc49
commit: e6b247c8e524dbe5fc03b3492f628d0d5348bc49
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2018-12-18T14:47:21+01:00
summary:

bpo-35523: Remove ctypes callback workaround (GH-11211)

Remove ctypes callback workaround: no longer create a callback at startup.
Avoid SELinux alert on "import ctypes" and "import uuid".

files:
A Misc/NEWS.d/next/Library/2018-12-18-13-52-13.bpo-35523.SkoMno.rst
M Lib/ctypes/__init__.py

diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
index 614677398864..5f78beda5866 100644
--- a/Lib/ctypes/__init__.py
+++ b/Lib/ctypes/__init__.py
@@ -266,11 +266,6 @@ def _reset_cache():
     # _SimpleCData.c_char_p_from_param
     POINTER(c_char).from_param = c_char_p.from_param
     _pointer_type_cache[None] = c_void_p
-    # XXX for whatever reasons, creating the first instance of a callback
-    # 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)
 
 def create_unicode_buffer(init, size=None):
     """create_unicode_buffer(aString) -> character array
diff --git a/Misc/NEWS.d/next/Library/2018-12-18-13-52-13.bpo-35523.SkoMno.rst b/Misc/NEWS.d/next/Library/2018-12-18-13-52-13.bpo-35523.SkoMno.rst
new file mode 100644
index 000000000000..94a9fd257383
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-12-18-13-52-13.bpo-35523.SkoMno.rst
@@ -0,0 +1,2 @@
+Remove :mod:`ctypes` callback workaround: no longer create a callback at
+startup. Avoid SELinux alert on ``import ctypes`` and ``import uuid``.



More information about the Python-checkins mailing list