Deallocates an instance; via holder, if constructed; otherwise via operator delete. NOTE: The Python error indicator needs to cleared BEFORE this function is called. This is because we could be deallocating while cleaning up after a Python exception. If the error indicator is not cleared but the C++ destructor code makes Python C API calls, those calls are likely to generate a new exception, and p
| 2838 | // throw `error_already_set` from the C++ destructor. This is forbidden and will |
| 2839 | // trigger std::terminate(). |
| 2840 | static void dealloc_impl(detail::value_and_holder &v_h) { |
| 2841 | if (v_h.holder_constructed()) { |
| 2842 | v_h.holder<holder_type>().~holder_type(); |
| 2843 | v_h.set_holder_constructed(false); |
| 2844 | } else { |
| 2845 | detail::call_operator_delete( |
| 2846 | v_h.value_ptr<type>(), v_h.type->type_size, v_h.type->type_align); |
| 2847 | } |
| 2848 | v_h.value_ptr() = nullptr; |
| 2849 | } |
| 2850 | |
| 2851 | static void dealloc_without_manipulating_gil(detail::value_and_holder &v_h) { |
| 2852 | error_scope scope; |
nothing calls this directly
no test coverage detected