Skip to content

Commit e25fee7

Browse files
author
Ralf W. Grosse-Kunstleve
committed
additional compile-time check: must_be_derived_from_pickle_suite
[SVN r14568]
1 parent bfe2a66 commit e25fee7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

include/boost/python/class.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ class class_ : public objects::class_base
200200
template <typename PickleSuiteType>
201201
self& def_pickle(PickleSuiteType)
202202
{
203+
error_messages::must_be_derived_from_pickle_suite(PickleSuiteType());
203204
detail::pickle_suite_finalize<PickleSuiteType>::register_(
204205
*this,
205206
&PickleSuiteType::getinitargs,

include/boost/python/object/pickle_support.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ namespace boost { namespace python {
1313

1414
handle<> make_instance_reduce_function();
1515

16+
struct pickle_suite;
17+
1618
namespace error_messages {
1719

1820
template <class T>
1921
struct missing_pickle_suite_function_or_incorrect_signature {};
2022

23+
inline void must_be_derived_from_pickle_suite(pickle_suite const&) {}
2124
}
2225

2326
namespace detail { struct pickle_suite_registration; }

0 commit comments

Comments
 (0)