[python3] 3.2.3-4: avoid allocating thunks in ctypes unless absolutely necessary (patch 155; rhbz#814391)

dmalcolm dmalcolm at fedoraproject.org
Fri Apr 20 19:30:05 UTC 2012


commit 8a28107df1670a03a12cf6a7787160f103d8d8c8
Author: David Malcolm <dmalcolm at redhat.com>
Date:   Fri Apr 20 15:28:39 2012 -0400

    3.2.3-4: avoid allocating thunks in ctypes unless absolutely necessary (patch 155; rhbz#814391)
    
    * Fri Apr 20 2012 David Malcolm <dmalcolm at redhat.com> - 3.2.3-4
    - avoid allocating thunks in ctypes unless absolutely necessary, to avoid
    generating SELinux denials on "import ctypes" and "import uuid" when embedding
    Python within httpd (patch 155; rhbz#814391)

 00155-avoid-ctypes-thunks.patch |   15 +++++++++++++++
 python3.spec                    |   17 ++++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/00155-avoid-ctypes-thunks.patch b/00155-avoid-ctypes-thunks.patch
new file mode 100644
index 0000000..f03890e
--- /dev/null
+++ b/00155-avoid-ctypes-thunks.patch
@@ -0,0 +1,15 @@
+diff -up Python-3.2.3/Lib/ctypes/__init__.py.rhbz814391 Python-3.2.3/Lib/ctypes/__init__.py
+--- Python-3.2.3/Lib/ctypes/__init__.py.rhbz814391	2012-04-20 15:12:49.017867692 -0400
++++ Python-3.2.3/Lib/ctypes/__init__.py	2012-04-20 15:15:09.501111408 -0400
+@@ -275,11 +275,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/python3.spec b/python3.spec
index 90694ee..ff3b480 100644
--- a/python3.spec
+++ b/python3.spec
@@ -122,7 +122,7 @@
 Summary: Version 3 of the Python programming language aka Python 3000
 Name: python3
 Version: %{pybasever}.3
-Release: 3%{?dist}
+Release: 4%{?dist}
 License: Python
 Group: Development/Languages
 
@@ -386,6 +386,14 @@ Patch152: 00152-fix-test-gdb-regex.patch
 # which values are printed as "v at entry" rather than just "v":
 Patch153: 00153-fix-test_gdb-noise.patch
 
+# python3.spec on f15 has:
+#  Patch154: 00154-skip-urllib-test-requiring-working-DNS.patch
+
+# Avoid allocating thunks in ctypes unless absolutely necessary, to avoid
+# generating SELinux denials on "import ctypes" and "import uuid" when
+# embedding Python within httpd (rhbz#814391)
+Patch155: 00155-avoid-ctypes-thunks.patch
+
 # (New patches go here ^^^)
 #
 # When adding new patches to "python" and "python3" in Fedora 17 onwards,
@@ -610,6 +618,8 @@ done
 # 00151: not for python3
 %patch152 -p0
 %patch153 -p0
+# 00154: not for this branch
+%patch155 -p1
 
 # Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there
 # are many differences between 2.6 and the Python 3 library.
@@ -1432,6 +1442,11 @@ rm -fr %{buildroot}
 # ======================================================
 
 %changelog
+* Fri Apr 20 2012 David Malcolm <dmalcolm at redhat.com> - 3.2.3-4
+- avoid allocating thunks in ctypes unless absolutely necessary, to avoid
+generating SELinux denials on "import ctypes" and "import uuid" when embedding
+Python within httpd (patch 155; rhbz#814391)
+
 * Fri Apr 20 2012 David Malcolm <dmalcolm at redhat.com> - 3.2.3-3
 - add explicit version requirements on expat to avoid linkage problems with
 XML_SetHashSalt


More information about the scm-commits mailing list