diff --git a/include/boost/python/class.hpp b/include/boost/python/class.hpp index 8491ba9c..1abf41cb 100644 --- a/include/boost/python/class.hpp +++ b/include/boost/python/class.hpp @@ -200,6 +200,7 @@ class class_ : public objects::class_base template self& def_pickle(PickleSuiteType) { + error_messages::must_be_derived_from_pickle_suite(PickleSuiteType()); detail::pickle_suite_finalize::register_( *this, &PickleSuiteType::getinitargs, diff --git a/include/boost/python/object/pickle_support.hpp b/include/boost/python/object/pickle_support.hpp index 6b68c47a..44e2103e 100644 --- a/include/boost/python/object/pickle_support.hpp +++ b/include/boost/python/object/pickle_support.hpp @@ -13,11 +13,14 @@ namespace boost { namespace python { handle<> make_instance_reduce_function(); +struct pickle_suite; + namespace error_messages { template struct missing_pickle_suite_function_or_incorrect_signature {}; + inline void must_be_derived_from_pickle_suite(pickle_suite const&) {} } namespace detail { struct pickle_suite_registration; }