Skip to content

Conversation

@cyyever
Copy link
Contributor

@cyyever cyyever commented Dec 8, 2025

Description

This PR skips the mentioned test on FreeBSD. Python modules are loaded with RTLD_LOCAL, which resolves the same C++ exception types into different global names. Furthermore, FreeBSD uses libc++, which unlike libstdc++, doesn't provide a specific conversion of such typeinfo differences. As a comparison, MacOS also uses libc++ but works because its modules are load with RTLD_GLOBAL (a special case handled in CPython).
The test build uses clang++19 on FreeBSD 15. But I also saw this failure on FreeBSD 14 with clang++16.

Before this PR, simply building with tests and running make check on FreeBSD outputs the error:

============================================================= FAILURES =============================================================
______________________________________________ test_cross_module_exception_translator ______________________________________________

    @pytest.mark.xfail(
        "(env.MACOS and env.PYPY) or env.ANDROID",
        raises=RuntimeError,
        reason="See Issue #2847, PR #2999, PR #4324",
        strict=not env.PYPY,  # PR 5569
    )
    def test_cross_module_exception_translator():
        with pytest.raises(KeyError):
            # translator registered in cross_module_tests
>           m.throw_should_be_translated_to_key_error()
E           RuntimeError


../../tests/test_exceptions.py:87: RuntimeError

It becomes XFAIL after this PR and all other tests also pass.

Signed-off-by: cyy <cyyever@outlook.com>
Signed-off-by: cyy <cyyever@outlook.com>
@cyyever cyyever requested a review from rwgk December 8, 2025 23:55
Copy link
Collaborator

@rwgk rwgk left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@rwgk rwgk merged commit 228f563 into pybind:master Dec 9, 2025
16 of 85 checks passed
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Dec 9, 2025
@cyyever cyyever deleted the bsd_fix branch December 9, 2025 00:14
@rwgk
Copy link
Collaborator

rwgk commented Dec 9, 2025

@cyyever I overlooked yesterday: Could you please also report the FreeBSD version and gcc version in the PR description?

Just something very simple, e.g. on my Ubuntu workstation I'd do this:

  • cat /etc/lsb-release
  • g++ --version

Then copy-paste the outputs to the PR description. So that when someone looks at the PR description in the future, they easily see meaningful information about the platform.

@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Dec 9, 2025
@cyyever
Copy link
Contributor Author

cyyever commented Dec 10, 2025

@rwgk I have added more information, BTW, I hadn't tested with gcc because clang is the default C/C++ compiler on FreeBSD.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants