8000 [3.7] bpo-16575: Disabled checks for union types being passed by value. (GH-17960) by vsajip · Pull Request #17970 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.7] bpo-16575: Disabled checks for union types being passed by value. (GH-17960) #17970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 12, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
(cherry picked from commit c12440c)
  • Loading branch information
vsajip committed Jan 12, 2020
commit d9132a4310c343e61967d6cfa17e585b5a28c9b1
3 changes: 2 additions & 1 deletion Lib/ctypes/test/test_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ class U(Union):
self.assertEqual(f2, [0x4567, 0x0123, 0xcdef, 0x89ab,
0x3210, 0x7654, 0xba98, 0xfedc])

@unittest.skipIf(True, 'Test disabled for now - see bpo-16575/bpo-16576')
def test_union_by_value(self):
# See bpo-16575

Expand Down Expand Up @@ -612,7 +613,7 @@ class Test5(Structure):
self.assertEqual(test5.nested.an_int, 0)
self.assertEqual(test5.another_int, 0)

#@unittest.skipIf('s390' in MACHINE, 'Test causes segfault on S390')
@unittest.skipIf(True, 'Test disabled for now - see bpo-16575/bpo-16576')
def test_bitfield_by_value(sel 8000 f):
# See bpo-16576

Expand Down
19 changes: 19 additions & 0 deletions Modules/_ctypes/_ctypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2277,6 +2277,23 @@ converters_from_argtypes(PyObject *ob)
for (i = 0; i < nArgs; ++i) {
PyObject *tp = PyTuple_GET_ITEM(ob, i);
PyObject *cnv;
/*
* 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) {
Expand Down Expand Up @@ -2304,6 +2321,8 @@ converters_from_argtypes(PyObject *ob)
return NULL;
}
}
*/

cnv = PyObject_GetAttrString(tp, "from_param");
if (!cnv)
goto argtypes_error_1;
Expand Down
0