Commit cd518f7
committed
Fix roundtrip unit test for derived Python objects
As expected, the unit test was failing because args were passed by-value
and not by reference. However, it wasn't possible to just change the policy
to reference or reference_internal.
reference gave errors, because const unique_ptr& only accepts reference_internal.
reference_internal gives an error, because the parent required for keep_alive is null.
Hence, I decided to introduce a new policy to explicitly indicate passing from
from Python to C++ via an overridden method. That's the cleanest solution to correctly
react to the special needs of this use case.1 parent a8a1eb3 commit cd518f7
File tree
4 files changed
+21
-11
lines changed- include/pybind11
- detail
4 files changed
+21
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
438 | 442 | | |
439 | 443 | | |
440 | 444 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
475 | 479 | | |
476 | 480 | | |
477 | 481 | | |
| |||
481 | 485 | | |
482 | 486 | | |
483 | 487 | | |
484 | | - | |
485 | | - | |
| 488 | + | |
| 489 | + | |
486 | 490 | | |
487 | 491 | | |
488 | | - | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
489 | 495 | | |
490 | 496 | | |
491 | 497 | | |
| |||
496 | 502 | | |
497 | 503 | | |
498 | 504 | | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | 505 | | |
504 | 506 | | |
505 | 507 | | |
| |||
723 | 725 | | |
724 | 726 | | |
725 | 727 | | |
726 | | - | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
727 | 731 | | |
728 | 732 | | |
729 | 733 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
899 | 899 | | |
900 | 900 | | |
901 | 901 | | |
| 902 | + | |
| 903 | + | |
902 | 904 | | |
903 | 905 | | |
904 | 906 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| |||
0 commit comments