|
Line 0
Link Here
|
|
|
1 |
bpo-16575: Disabled checks for union types being passed by value. |
| 2 |
|
| 3 |
https://github.com/python/cpython/pull/17960 |
| 4 |
|
| 5 |
databases/grass7 wxPython gui needs this patch |
| 6 |
Context here: https://trac.osgeo.org/grass/ticket/4015 |
| 7 |
|
| 8 |
--- Modules/_ctypes/_ctypes.c.orig 2020-03-01 17:40:43 UTC |
| 9 |
+++ Modules/_ctypes/_ctypes.c |
| 10 |
@@ -2277,6 +2277,23 @@ converters_from_argtypes(PyObject *ob) |
| 11 |
for (i = 0; i < nArgs; ++i) { |
| 12 |
PyObject *tp = PyTuple_GET_ITEM(ob, i); |
| 13 |
PyObject *cnv; |
| 14 |
+/* |
| 15 |
+ * The following checks, relating to bpo-16575 and bpo-16576, have been |
| 16 |
+ * disabled. The reason is that, although there is a definite problem with |
| 17 |
+ * how libffi handles unions (https://github.com/libffi/libffi/issues/33), |
| 18 |
+ * there are numerous libraries which pass structures containing unions |
| 19 |
+ * by values - especially on Windows but examples also exist on Linux |
| 20 |
+ * (https://bugs.python.org/msg359834). |
| 21 |
+ * |
| 22 |
+ * It may not be possible to get proper support for unions and bitfields |
| 23 |
+ * until support is forthcoming in libffi, but for now, adding the checks |
| 24 |
+ * has caused problems in otherwise-working software, which suggests it |
| 25 |
+ * is better to disable the checks. |
| 26 |
+ * |
| 27 |
+ * Although specific examples reported relate specifically to unions and |
| 28 |
+ * not bitfields, the bitfields check is also being disabled as a |
| 29 |
+ * precaution. |
| 30 |
+ |
| 31 |
StgDictObject *stgdict = PyType_stgdict(tp); |
| 32 |
|
| 33 |
if (stgdict != NULL) { |
| 34 |
@@ -2304,6 +2321,7 @@ converters_from_argtypes(PyObject *ob) |
| 35 |
return NULL; |
| 36 |
} |
| 37 |
} |
| 38 |
+*/ |
| 39 |
cnv = PyObject_GetAttrString(tp, "from_param"); |
| 40 |
if (!cnv) |
| 41 |
goto argtypes_error_1; |