Skip to content
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

WIP: Guard against Python multiple inheritance divergence #4928

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Nov 8, 2023

Description

WIP: Follow-on to PR #4762.

Companion branch: google/pybind11k#30079

Major things to do:

def NOtest_PPPCCC():
    # terminate called after throwing an instance of 'pybind11::error_already_set'
    # what():  TypeError: bases include diverging derived types:
    #     base=pybind11_tests.python_multiple_inheritance.CppBase,
    #     derived1=pybind11_tests.python_multiple_inheritance.CppDrvd,
    #     derived2=pybind11_tests.python_multiple_inheritance.CppDrvd2
    PPPCCC(11)
  • Document advice for how to handle divergence. Roughly (untested): create a C++ derived type (e.g. class CppDrvd1Plus2 : CppDrvd, CppDrvd2 { ... };), wrap with class_<CppDrvd1Plus2>, in Python inherit from CppDrvd1Plus2 instead of CppDrvd, CppDrvd2 separately.

Suggested changelog entry:

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.

None yet

1 participant