diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2020-01-12 08:54:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-12 08:54:00 +0000 |
commit | c12440c371025bea9c3bfb94945f006c486c2c01 (patch) | |
tree | 22e216f51136345710e8c22f2b4290b3c66ce138 /Modules/_ctypes | |
parent | 100fafcf20e8fc67cd8ef512074f9c0a253cb427 (diff) | |
download | cpython-git-c12440c371025bea9c3bfb94945f006c486c2c01.tar.gz |
bpo-16575: Disabled checks for union types being passed by value. (GH-17960)
Although the underlying libffi issue remains open, adding these
checks have caused problems in third-party projects which are in
widespread use. See the issue for examples.
The corresponding tests have also been skipped.
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r-- | Modules/_ctypes/_ctypes.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c index 93af497bda..cb6e03f2ca 100644 --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -2401,6 +2401,23 @@ converters_from_argtypes(PyObject *ob) for (i = 0; i < nArgs; ++i) { PyObject *cnv; PyObject *tp = PyTuple_GET_ITEM(ob, i); +/* + * The following checks, relating to bpo-16575 and bpo-16576, have been + * disabled. The reason is that, although there is a definite problem with + * how libffi handles unions (https://github.com/libffi/libffi/issues/33), + * there are numerous libraries which pass structures containing unions + * by values - especially on Windows but examples also exist on Linux + * (https://bugs.python.org/msg359834). + * + * It may not be possible to get proper support for unions and bitfields + * until support is forthcoming in libffi, but for now, adding the checks + * has caused problems in otherwise-working software, which suggests it + * is better to disable the checks. + * + * Although specific examples reported relate specifically to unions and + * not bitfields, the bitfields check is also being disabled as a + * precaution. + StgDictObject *stgdict = PyType_stgdict(tp); if (stgdict != NULL) { @@ -2428,6 +2445,7 @@ converters_from_argtypes(PyObject *ob) return NULL; } } + */ if (_PyObject_LookupAttrId(tp, &PyId_from_param, &cnv) <= 0) { Py_DECREF(converters); |