Skip to content

gh-151422: Don't link libffi into _ctypes_test.so#151423

Open
hoodmane wants to merge 2 commits into
python:mainfrom
hoodmane:dont-link-libffi-into-ctypes-test
Open

gh-151422: Don't link libffi into _ctypes_test.so#151423
hoodmane wants to merge 2 commits into
python:mainfrom
hoodmane:dont-link-libffi-into-ctypes-test

Conversation

@hoodmane

@hoodmane hoodmane commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Minor build fix. This makes the ctypes tests run on Emscripten.

There is a bug in the Emscripten dynamic loader that caused any dynamic library that links libffi to fail to load. _ctypes_test.so unnecessarily links libffi so it would fail to load and tests that needed it were skipped.

There are two test failures behind that: one involving stack overflows which we have to skip as usual, and one that assumes that the abi for a function that takes a single struct with two doubles is the same as the abi for a function that takes two double arguments. This is not true in webassembly so we skip the test.

@hoodmane hoodmane force-pushed the dont-link-libffi-into-ctypes-test branch from 295fabb to 4fb91c5 Compare June 13, 2026 15:22
@hoodmane hoodmane added the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 14, 2026

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense; one question inline about the skip strategy.

The only question is about why libffi was linked in the first place. It appears to have been introduced in #120894, but I can't see any reason why it would have been (other than oversight/overenthusiasm that didn't hurt anything at the time).

That patch was included in the development of 3.14; you've flagged this for 3.15 back porting - can you think of any reason this shouldn't be backported to 3.14 as well?

Comment on lines +310 to +312
if support.is_wasm32:
self.skipTest(
"wasm ABI is incompatible with test expectations")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason this is done as in-test logic, rather than a @skipif(support.is_wasm32, ...)?

@bedevere-app

bedevere-app Bot commented Jun 15, 2026

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes needs backport to 3.15 pre-release feature fixes, bugs and security fixes skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants