56
56
# include < cxxabi.h>
57
57
#endif
58
58
59
+ #define TRIGGER_SEGSEV { unsigned long *bad = nullptr ; *bad = -1 ; }
60
+
59
61
PYBIND11_NAMESPACE_BEGIN (PYBIND11_NAMESPACE)
60
62
61
63
// / Wraps an arbitrary C++ function/method/lambda function/.. into a callable Python object
@@ -97,7 +99,7 @@ class cpp_function : public function {
97
99
// / Construct a cpp_function from a class method (const, no ref-qualifier)
98
100
template <typename Return, typename Class, typename ... Arg, typename ... Extra>
99
101
cpp_function (Return (Class::*f)(Arg...) const , const Extra&... extra) {
100
- initialize ([f](const Class *c, Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); },
102
+ initialize ([f](const Class *c, Arg... args) -> Return { return (c->*f)(std::forward<Arg>(args)...); }, // GET_INT_STACK -1
101
103
(Return (*)(const Class *, Arg ...)) nullptr , extra...);
102
104
}
103
105
@@ -158,7 +160,7 @@ class cpp_function : public function {
158
160
" The number of argument annotations does not match the number of function arguments" );
159
161
160
162
/* Dispatch code which converts function arguments and performs the actual function call */
161
- rec->impl = [](function_call &call) -> handle {
163
+ rec->impl = [](function_call &call) -> handle { // GET_INT_STACK -5
162
164
cast_in args_converter;
163
165
164
166
/* Try to cast the function arguments into the C++ domain */
@@ -181,7 +183,7 @@ class cpp_function : public function {
181
183
182
184
/* Perform the function call */
183
185
handle result = cast_out::cast (
184
- std::move (args_converter).template call <Return, Guard>(cap->f ), policy, call.parent );
186
+ std::move (args_converter).template call <Return, Guard>(cap->f ), policy, call.parent ); // GET_INT_STACK -4
185
187
186
188
/* Invoke call policy post-call hook */
187
189
process_attributes<Extra...>::postcall (call, result);
@@ -502,7 +504,7 @@ class cpp_function : public function {
502
504
handle parent = n_args_in > 0 ? PyTuple_GET_ITEM (args_in, 0 ) : nullptr ,
503
505
result = PYBIND11_TRY_NEXT_OVERLOAD;
504
506
505
- auto self_value_and_holder = value_and_holder ();
507
+ auto self_value_and_holder = value_and_holder (); // cast.h
506
508
if (overloads->is_constructor ) {
507
509
const auto tinfo = get_type_info ((PyTypeObject *) overloads->scope .ptr ());
508
510
const auto pi = reinterpret_cast <instance *>(parent.ptr ());
@@ -714,7 +716,7 @@ class cpp_function : public function {
714
716
// 6. Call the function.
715
717
try {
716
718
loader_life_support guard{};
717
- result = func.impl (call);
719
+ result = func.impl (call); // GET_INT_STACK -6
718
720
} catch (reference_cast_error &) {
719
721
result = PYBIND11_TRY_NEXT_OVERLOAD;
720
722
}
@@ -880,7 +882,7 @@ class cpp_function : public function {
880
882
} else {
881
883
if (overloads->is_constructor && !self_value_and_holder.holder_constructed ()) {
882
884
auto *pi = reinterpret_cast <instance *>(parent.ptr ());
883
- self_value_and_holder.type ->init_instance (pi, nullptr );
885
+ self_value_and_holder.type ->init_instance (pi, nullptr ); // GET_STACK -4
884
886
}
885
887
return result.ptr ();
886
888
}
@@ -1487,7 +1489,7 @@ class class_ : public detail::generic_type {
1487
1489
init_holder_from_existing (v_h, holder_ptr, std::is_copy_constructible<holder_type>());
1488
1490
v_h.set_holder_constructed ();
1489
1491
} else if (inst->owned || detail::always_construct_holder<holder_type>::value) {
1490
- new (std::addressof (v_h.holder <holder_type>())) holder_type (v_h.value_ptr <type>());
1492
+ new (std::addressof (v_h.holder <holder_type>())) holder_type (v_h.value_ptr <type>()); // GET_STACK -2
1491
1493
v_h.set_holder_constructed ();
1492
1494
}
1493
1495
}
@@ -1502,7 +1504,7 @@ class class_ : public detail::generic_type {
1502
1504
register_instance (inst, v_h.value_ptr (), v_h.type );
1503
1505
v_h.set_instance_registered ();
1504
1506
}
1505
- init_holder (inst, v_h, (const holder_type *) holder_ptr, v_h.value_ptr <type>());
1507
+ init_holder (inst, v_h, (const holder_type *) holder_ptr, v_h.value_ptr <type>()); // GET_STACK -3
1506
1508
}
1507
1509
1508
1510
// / Deallocates an instance; via holder, if constructed; otherwise via operator delete.
0 commit comments