Skip to content

Commit aa48555

Browse files
[3.14] gh-151422: Don't link libffi into _ctypes_test.so (GH-151423) (#151517)
_ctypes_test doesn't use libffi directly, and linking it into the module causes emscripten tests to fail. (cherry picked from commit 8646385) Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com>
1 parent 462f64b commit aa48555

4 files changed

Lines changed: 14 additions & 4 deletions

File tree

Lib/test/test_ctypes/test_as_parameter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
c_short, c_int, c_long, c_longlong,
66
c_byte, c_wchar, c_float, c_double,
77
ArgumentError)
8-
from test.support import import_helper, skip_if_sanitizer
8+
from test.support import import_helper, skip_if_sanitizer, skip_emscripten_stack_overflow
99
_ctypes_test = import_helper.import_module("_ctypes_test")
1010

1111

@@ -193,6 +193,7 @@ class S8I(Structure):
193193
(9*2, 8*3, 7*4, 6*5, 5*6, 4*7, 3*8, 2*9))
194194

195195
@skip_if_sanitizer('requires deep stack', thread=True)
196+
@skip_emscripten_stack_overflow()
196197
def test_recursive_as_param(self):
197198
class A:
198199
pass

Lib/test/test_ctypes/test_structures.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,16 @@ class X(Structure):
299299
self.assertEqual(s.first, got.first)
300300
self.assertEqual(s.second, got.second)
301301

302+
@unittest.skipIf(support.is_wasm32, "wasm ABI is incompatible with test expectations")
302303
def _test_issue18060(self, Vector):
303304
# Regression tests for gh-62260
304305

306+
# This test passes a struct of two doubles by value to atan2(), whose C
307+
# signature is atan2(double, double), so it only works on platforms
308+
# where the abi of a function that takes a struct with two doubles
309+
# matches the abi of a function that takes two doubles. The wasm32 ABI
310+
# does not satisfy this condition and the test breaks.
311+
305312
# The call to atan2() should succeed if the
306313
# class fields were correctly cloned in the
307314
# subclasses. Otherwise, it will segfault.

configure

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8217,9 +8217,11 @@ PY_STDLIB_MOD([_testmultiphase], [test "$TEST_MODULES" = yes], [test "$ac_cv_fun
82178217
PY_STDLIB_MOD([_testsinglephase], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
82188218
PY_STDLIB_MOD([xxsubtype], [test "$TEST_MODULES" = yes])
82198219
PY_STDLIB_MOD([_xxtestfuzz], [test "$TEST_MODULES" = yes])
8220+
dnl Check have_libffi so _ctypes_test is only built if _ctypes is built.
8221+
dnl _ctypes_test doesn't use libffi directly.
82208222
PY_STDLIB_MOD([_ctypes_test],
82218223
[test "$TEST_MODULES" = yes], [test "$have_libffi" = yes -a "$ac_cv_func_dlopen" = yes],
8222-
[$LIBFFI_CFLAGS], [$LIBFFI_LIBS $LIBM])
8224+
[], [$LIBM])
82238225

82248226
dnl Limited API template modules.
82258227
dnl Emscripten does not support shared libraries yet.

0 commit comments

Comments
 (0)