Skip to content

Conversation

gentlegiantJGC
Copy link
Contributor

@gentlegiantJGC gentlegiantJGC commented Jul 24, 2025

Description

The documentation examples for py::trampoline_self_life_support inherit it privately which I belive is incorrect.

Suggested changelog entry:

  • Fix py::trampoline_self_life_support visibility in docs

📚 Documentation preview 📚: https://pybind11--5766.org.readthedocs.build/

C++ classes default inheritance rule is private.
I believe py::trampoline_self_life_support must be public to work correctly.
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.

Thanks for catching these!

@rwgk
Copy link
Collaborator

rwgk commented Jul 24, 2025

@b-pass this flake looks a little worrying:

https://github.com/pybind/pybind11/actions/runs/16496837953/job/46644528777?pr=5766

Copy-pasting from the CI log, for future reference:

> Run cmake --build build --target cpptest

Change Dir: '/home/runner/work/pybind11/pybind11/build'

Run Build Command(s): /usr/local/bin/ninja -v cpptest
[0/2] /usr/local/bin/cmake -P /home/runner/work/pybind11/pybind11/build/CMakeFiles/VerifyGlobs.cmake
[1/2] cd /home/runner/work/pybind11/pybind11/build/tests/test_embed && /home/runner/work/pybind11/pybind11/build/tests/test_embed/test_embed
FAILED: [code=139] tests/test_embed/CMakeFiles/cpptest /home/runner/work/pybind11/pybind11/build/tests/test_embed/CMakeFiles/cpptest 
cd /home/runner/work/pybind11/pybind11/build/tests/test_embed && /home/runner/work/pybind11/pybind11/build/tests/test_embed/test_embed
Exception ignored in: <module 'threading' from '/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/threading.py'>
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/threading.py", line 1602, in _shutdown
    assert tlock.locked()
           ^^^^^^^^^^^^^^
AssertionError: 
Debug memory block at address p=0x7f86bc10f200: API 'E'
    4642792059332132864 bytes originally requested
    The 7 pad bytes at p-7 are not all FORBIDDENBYTE (0xfd):
        at p-7: 0x00 *** OUCH
        at p-6: 0x00 *** OUCH
        at p-5: 0x00 *** OUCH
        at p-4: 0x00 *** OUCH
        at p-3: 0x00 *** OUCH
        at p-2: 0x00 *** OUCH
        at p-1: 0x00 *** OUCH
    Because memory is corrupted at the start, the count of bytes requested
       may be bogus, and checking the trailing pad bytes may segfault.
    The 8 pad bytes at tail=0x406f024e428ff200 are 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_embed is a Catch v2.13.10 host application.
Run with -? for options

-------------------------------------------------------------------------------
Per-Subinterpreter GIL
-------------------------------------------------------------------------------
/home/runner/work/pybind11/pybind11/tests/test_embed/test_subinterpreter.cpp:303
...............................................................................

/home/runner/work/pybind11/pybind11/tests/test_embed/test_subinterpreter.cpp:303: FAILED:
  {Unknown expression after the reported line}
due to a fatal error condition:
  SIGSEGV - Segmentation violation signal

===============================================================================
test cases:   20 |   19 passed | 1 failed
assertions: 1588 | 1587 passed | 1 failed

Fatal Python error: Segmentation fault

Current thread 0x00007f86b1ffd6c0 (most recent call first):
  File "<frozen importlib._bootstrap_external>", line 1652 in _fill_cache
  File "<frozen importlib._bootstrap_external>", line 1609 in find_spec
  File "<frozen importlib._bootstrap_external>", line 1506 in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1532 in find_spec
  File "<frozen importlib._bootstrap>", line 1262 in _find_spec
  File "<frozen importlib._bootstrap>", line 1322 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
  File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1415 in _handle_fromlist
  File "/opt/hostedtoolcache/Python/3.12.11/x64/lib/python3.12/encodings/__init__.py", line 33 in <module>
  File "<frozen importlib._bootstrap>", line 488 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 999 in exec_module
  File "<frozen importlib._bootstrap>", line 935 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1331 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1360 in _find_and_load
Segmentation fault (core dumped)
ninja: build stopped: subcommand failed.

Error: Process completed with exit code 139.

@rwgk rwgk merged commit 6aeae9c into pybind:master Jul 24, 2025
81 of 82 checks passed
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Jul 24, 2025
@gentlegiantJGC gentlegiantJGC deleted the public-trampoline branch July 24, 2025 15:43
@henryiii henryiii changed the title Fix py::trampoline_self_life_support visibility in docs docs: fix py::trampoline_self_life_support visibility in docs Aug 21, 2025
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Aug 22, 2025
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.

3 participants