pybind11/example/issues.ref
Jason Rhinelander 1b05ce5bc0 Track registered instances that share a pointer address
The pointer to the first member of a class instance is the same as the
pointer to instance itself; pybind11 has some workarounds for this to
not track registered instances that have a registered parent with the
same address.  This doesn't work everywhere, however: issue #328 is a
failure of this for a mutator operator which resolves its argument to
the parent rather than the child, as is needed in #328.

This commit resolves the issue (and restores tracking of same-address
instances) by changing registered_instances from an unordered_map to an
unordered_multimap that allows duplicate instances for the same pointer
to be recorded, then resolves these differences by checking the type of
each matched instance when looking up an instance.  (A
unordered_multimap seems cleaner for this than a unordered_map<list> or
similar because, the vast majority of the time, the instance will be
unique).
2016-08-09 17:57:59 -04:00

45 lines
1.2 KiB
Plaintext

const char *
c
Failed as expected: Tried to call pure virtual function "Base::dispatch"
Yay..
[Placeholder[1], Placeholder[2], Placeholder[3], Placeholder[4]]
[3, 5, 7, 9, 11, 13, 15]
0==0, 1==1, 2==2, 3==3, 4==4, 5==5, 6==6, 7==7, 8==8, 9==9,
Failed as expected: Incompatible function arguments. The following argument types are supported:
1. (arg0: example.issues.ElementA) -> None
Invoked with: None
Failed as expected: Incompatible function arguments. The following argument types are supported:
1. (arg0: int) -> int
Invoked with: 5.2
12.0
C++ version
A.f()
Python version
PyA.PyA()
PyA.f()
In python f()
StrIssue.__str__ called
StrIssue[3]
Failed as expected: Incompatible constructor arguments. The following argument types are supported:
1. example.issues.StrIssue(arg0: int)
2. example.issues.StrIssue()
Invoked with: no, such, constructor
NestA@0x1152940 constructor
NestA@0x11f9350 constructor
NestB@0x11f9350 constructor
NestA@0x112d0d0 constructor
NestB@0x112d0d0 constructor
NestC@0x112d0d0 constructor
13
103
1003
3
1
35
NestC@0x112d0d0 destructor
NestB@0x112d0d0 destructor
NestA@0x112d0d0 destructor
NestB@0x11f9350 destructor
NestA@0x11f9350 destructor
NestA@0x1152940 destructor