-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bindings of classes derived from a trampoline
Binding of deeper (>= 2 levels) class hierarchies that inherit from a trampoline class fail in Python 3.12+. For example, in the added test suite class ``SiameseCat``, this produces the following error message: Critical nanobind error: nanobind::detail::nb_type_new("SiameseCat"): type construction failed: TypeError: tp_basicsize for type 'test_classes_ext.SiameseCat' (56) is too small for base 'test_classes_ext.Cat' (88)! The trick to make Python happy is to carefully walk through the parent classes to look for trampolines. Previously, only the direct parent was checked.
- Loading branch information
Showing
3 changed files
with
30 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters