mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-19 17:32:37 +00:00
WIP
This commit is contained in:
parent
55530437fc
commit
1522f57d2d
@ -55,7 +55,7 @@ inline std::unordered_map<std::type_index, std::uint64_t> &odr_guard_registry()
|
||||
namespace {
|
||||
|
||||
template <typename IntrinsicType>
|
||||
bool odr_guard_impl(const std::type_index & it_ti, const std::uint64_t& tc_id) {
|
||||
bool odr_guard_impl(const std::type_index &it_ti, const std::uint64_t &tc_id) {
|
||||
printf("\nLOOOK %s %llu\n", type_id<IntrinsicType>().c_str(), (long long) tc_id);
|
||||
fflush(stdout);
|
||||
auto [reg_iter, added] = odr_guard_registry().insert({it_ti, tc_id});
|
||||
@ -73,10 +73,9 @@ struct type_caster_odr_guard : type_caster<IntrinsicType> {
|
||||
};
|
||||
|
||||
template <typename IntrinsicType>
|
||||
int type_caster_odr_guard<IntrinsicType>::translation_unit_local = [](){
|
||||
odr_guard_impl<IntrinsicType>(
|
||||
std::type_index(typeid(IntrinsicType)),
|
||||
type_caster<IntrinsicType>::universally_unique_identifier);
|
||||
int type_caster_odr_guard<IntrinsicType>::translation_unit_local = []() {
|
||||
odr_guard_impl<IntrinsicType>(std::type_index(typeid(IntrinsicType)),
|
||||
type_caster<IntrinsicType>::universally_unique_identifier.value);
|
||||
return 0;
|
||||
}();
|
||||
|
||||
@ -85,6 +84,10 @@ int type_caster_odr_guard<IntrinsicType>::translation_unit_local = [](){
|
||||
template <typename type>
|
||||
using make_caster = type_caster_odr_guard<intrinsic_t<type>>;
|
||||
|
||||
#define PYBIND11_DETAIL_TYPE_CASTER_ACCESS_TRANSLATION_UNIT_LOCAL(...) \
|
||||
if (::pybind11::detail::make_caster<__VA_ARGS__>::translation_unit_local) { \
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct type_uses_smart_holder_type_caster {
|
||||
static constexpr bool value
|
||||
@ -94,15 +97,13 @@ struct type_uses_smart_holder_type_caster {
|
||||
// Shortcut for calling a caster's `cast_op_type` cast operator for casting a type_caster to a T
|
||||
template <typename T>
|
||||
typename make_caster<T>::template cast_op_type<T> cast_op(make_caster<T> &caster) { // LOOOK
|
||||
if (make_caster<T>::translation_unit_local) {
|
||||
}
|
||||
PYBIND11_DETAIL_TYPE_CASTER_ACCESS_TRANSLATION_UNIT_LOCAL(T)
|
||||
return caster.operator typename make_caster<T>::template cast_op_type<T>();
|
||||
}
|
||||
template <typename T>
|
||||
typename make_caster<T>::template cast_op_type<typename std::add_rvalue_reference<T>::type>
|
||||
cast_op(make_caster<T> &&caster) { // LOOOK
|
||||
if (make_caster<T>::translation_unit_local) {
|
||||
}
|
||||
PYBIND11_DETAIL_TYPE_CASTER_ACCESS_TRANSLATION_UNIT_LOCAL(T)
|
||||
return std::move(caster).operator typename make_caster<T>::
|
||||
template cast_op_type<typename std::add_rvalue_reference<T>::type>();
|
||||
}
|
||||
@ -124,7 +125,7 @@ private:
|
||||
public:
|
||||
bool load(handle src, bool convert) { return subcaster.load(src, convert); }
|
||||
static constexpr auto name = caster_t::name;
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
static handle
|
||||
cast(const std::reference_wrapper<type> &src, return_value_policy policy, handle parent) {
|
||||
// It is definitely wrong to take ownership of this pointer, so mask that rvp
|
||||
@ -296,7 +297,7 @@ public:
|
||||
}
|
||||
|
||||
PYBIND11_TYPE_CASTER(T, const_name<std::is_integral<T>::value>("int", "float"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@ -312,7 +313,7 @@ public:
|
||||
return none().inc_ref();
|
||||
}
|
||||
PYBIND11_TYPE_CASTER(T, const_name("None"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
template <>
|
||||
@ -360,7 +361,7 @@ public:
|
||||
using cast_op_type = void *&;
|
||||
explicit operator void *&() { return value; }
|
||||
static constexpr auto name = const_name("capsule");
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
private:
|
||||
void *value = nullptr;
|
||||
@ -417,7 +418,7 @@ public:
|
||||
return handle(src ? Py_True : Py_False).inc_ref();
|
||||
}
|
||||
PYBIND11_TYPE_CASTER(bool, const_name("bool"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
// Helper class for UTF-{8,16,32} C++ stl strings:
|
||||
@ -510,7 +511,7 @@ struct string_caster {
|
||||
}
|
||||
|
||||
PYBIND11_TYPE_CASTER(StringType, const_name(PYBIND11_STRING_NAME));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
private:
|
||||
static handle decode_utfN(const char *buffer, ssize_t nbytes) {
|
||||
@ -683,7 +684,7 @@ public:
|
||||
}
|
||||
|
||||
static constexpr auto name = const_name(PYBIND11_STRING_NAME);
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
template <typename _T>
|
||||
using cast_op_type = pybind11::detail::cast_op_type<_T>;
|
||||
};
|
||||
@ -728,7 +729,7 @@ public:
|
||||
|
||||
static constexpr auto name
|
||||
= const_name("Tuple[") + concat(make_caster<Ts>::name...) + const_name("]");
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
template <typename T>
|
||||
using cast_op_type = type;
|
||||
@ -901,7 +902,7 @@ struct move_only_holder_caster {
|
||||
return type_caster_base<type>::cast_holder(ptr, std::addressof(src));
|
||||
}
|
||||
static constexpr auto name = type_caster_base<type>::name;
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
#ifndef PYBIND11_USE_SMART_HOLDER_AS_DEFAULT
|
||||
@ -1011,7 +1012,7 @@ struct pyobject_caster {
|
||||
return src.inc_ref();
|
||||
}
|
||||
PYBIND11_TYPE_CASTER(type, handle_type_name<type>::name);
|
||||
static constexpr std::uint64_t universally_unique_identifier = 3434;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(3434)
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@ -1106,8 +1107,7 @@ type_caster<T, SFINAE> &load_type(type_caster<T, SFINAE> &conv, const handle &ha
|
||||
// Wrapper around the above that also constructs and returns a type_caster
|
||||
template <typename T>
|
||||
make_caster<T> load_type(const handle &handle) {
|
||||
if (make_caster<T>::translation_unit_local) {
|
||||
}
|
||||
PYBIND11_DETAIL_TYPE_CASTER_ACCESS_TRANSLATION_UNIT_LOCAL(T)
|
||||
make_caster<T> conv;
|
||||
load_type(conv, handle);
|
||||
return conv;
|
||||
@ -1145,8 +1145,7 @@ object cast(T &&value,
|
||||
: std::is_lvalue_reference<T>::value ? return_value_policy::copy
|
||||
: return_value_policy::move;
|
||||
}
|
||||
if (detail::make_caster<T>::translation_unit_local) {
|
||||
}
|
||||
PYBIND11_DETAIL_TYPE_CASTER_ACCESS_TRANSLATION_UNIT_LOCAL(T)
|
||||
return reinterpret_steal<object>(
|
||||
detail::make_caster<T>::cast(std::forward<T>(value), policy, parent));
|
||||
}
|
||||
@ -1247,8 +1246,7 @@ using override_caster_t = conditional_t<cast_is_temporary_value_reference<ret_ty
|
||||
template <typename T>
|
||||
enable_if_t<cast_is_temporary_value_reference<T>::value, T> cast_ref(object &&o,
|
||||
make_caster<T> &caster) {
|
||||
if (make_caster<T>::translation_unit_local) {
|
||||
}
|
||||
PYBIND11_DETAIL_TYPE_CASTER_ACCESS_TRANSLATION_UNIT_LOCAL(T)
|
||||
return cast_op<T>(load_type(caster, o));
|
||||
}
|
||||
template <typename T>
|
||||
@ -1360,8 +1358,7 @@ private:
|
||||
type(type_id<T>())
|
||||
#endif
|
||||
{
|
||||
if (detail::make_caster<T>::translation_unit_local) {
|
||||
}
|
||||
PYBIND11_DETAIL_TYPE_CASTER_ACCESS_TRANSLATION_UNIT_LOCAL(T)
|
||||
// Workaround! See:
|
||||
// https://github.com/pybind/pybind11/issues/2336
|
||||
// https://github.com/pybind/pybind11/pull/2685#issuecomment-731286700
|
||||
@ -1592,8 +1589,7 @@ public:
|
||||
private:
|
||||
template <typename T>
|
||||
void process(list &args_list, T &&x) {
|
||||
if (make_caster<T>::translation_unit_local) {
|
||||
}
|
||||
PYBIND11_DETAIL_TYPE_CASTER_ACCESS_TRANSLATION_UNIT_LOCAL(T)
|
||||
auto o = reinterpret_steal<object>(
|
||||
detail::make_caster<T>::cast(std::forward<T>(x), policy, {}));
|
||||
if (!o) {
|
||||
@ -1738,8 +1734,7 @@ handle type::handle_of() {
|
||||
detail::type_uses_smart_holder_type_caster<T>>::value,
|
||||
"py::type::of<T> only supports the case where T is a registered C++ types.");
|
||||
|
||||
if (detail::make_caster<T>::translation_unit_local) {
|
||||
}
|
||||
PYBIND11_DETAIL_TYPE_CASTER_ACCESS_TRANSLATION_UNIT_LOCAL(T)
|
||||
return detail::get_type_handle(typeid(T), true);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ public:
|
||||
}
|
||||
|
||||
PYBIND11_TYPE_CASTER(type, const_name("datetime.timedelta"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
inline std::tm *localtime_thread_safe(const std::time_t *time, std::tm *buf) {
|
||||
@ -209,7 +209,7 @@ public:
|
||||
us.count());
|
||||
}
|
||||
PYBIND11_TYPE_CASTER(type, const_name("datetime.datetime"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
// Other clocks that are not the system clock are not measured as datetime.datetime objects
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
}
|
||||
|
||||
PYBIND11_TYPE_CASTER(std::complex<T>, const_name("complex"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
PYBIND11_NAMESPACE_END(detail)
|
||||
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
using cast_op_type = value_and_holder &;
|
||||
explicit operator value_and_holder &() { return *value; }
|
||||
static constexpr auto name = const_name<value_and_holder>();
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
private:
|
||||
value_and_holder *value = nullptr;
|
||||
|
@ -616,7 +616,7 @@ template <typename T>
|
||||
struct smart_holder_type_caster : smart_holder_type_caster_load<T>,
|
||||
smart_holder_type_caster_class_hooks {
|
||||
static constexpr auto name = const_name<T>();
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
// static handle cast(T, ...)
|
||||
// is redundant (leads to ambiguous overloads).
|
||||
@ -778,7 +778,7 @@ template <typename T>
|
||||
struct smart_holder_type_caster<std::shared_ptr<T>> : smart_holder_type_caster_load<T>,
|
||||
smart_holder_type_caster_class_hooks {
|
||||
static constexpr auto name = const_name<T>();
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
static handle cast(const std::shared_ptr<T> &src, return_value_policy policy, handle parent) {
|
||||
switch (policy) {
|
||||
@ -843,7 +843,7 @@ template <typename T>
|
||||
struct smart_holder_type_caster<std::shared_ptr<T const>> : smart_holder_type_caster_load<T>,
|
||||
smart_holder_type_caster_class_hooks {
|
||||
static constexpr auto name = const_name<T>();
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
static handle
|
||||
cast(const std::shared_ptr<T const> &src, return_value_policy policy, handle parent) {
|
||||
@ -864,7 +864,7 @@ template <typename T, typename D>
|
||||
struct smart_holder_type_caster<std::unique_ptr<T, D>> : smart_holder_type_caster_load<T>,
|
||||
smart_holder_type_caster_class_hooks {
|
||||
static constexpr auto name = const_name<T>();
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
static handle cast(std::unique_ptr<T, D> &&src, return_value_policy policy, handle parent) {
|
||||
if (policy != return_value_policy::automatic
|
||||
@ -948,7 +948,7 @@ template <typename T, typename D>
|
||||
struct smart_holder_type_caster<std::unique_ptr<T const, D>>
|
||||
: smart_holder_type_caster_load<T>, smart_holder_type_caster_class_hooks {
|
||||
static constexpr auto name = const_name<T>();
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
static handle
|
||||
cast(std::unique_ptr<T const, D> &&src, return_value_policy policy, handle parent) {
|
||||
|
@ -904,6 +904,17 @@ struct polymorphic_type_hook : public polymorphic_type_hook_base<itype> {};
|
||||
|
||||
PYBIND11_NAMESPACE_BEGIN(detail)
|
||||
|
||||
namespace {
|
||||
template <std::uint64_t Value>
|
||||
struct universally_unique_identifier_holder {
|
||||
static constexpr std::uint64_t value = Value;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
#define PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(...) \
|
||||
static constexpr ::pybind11::detail::universally_unique_identifier_holder<__VA_ARGS__> \
|
||||
universally_unique_identifier;
|
||||
|
||||
/// Generic type caster for objects stored on the heap
|
||||
template <typename type>
|
||||
class type_caster_base : public type_caster_generic {
|
||||
@ -911,7 +922,7 @@ class type_caster_base : public type_caster_generic {
|
||||
|
||||
public:
|
||||
static constexpr auto name = const_name<type>();
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
type_caster_base() : type_caster_base(typeid(type)) {}
|
||||
explicit type_caster_base(const std::type_info &info) : type_caster_generic(info) {}
|
||||
|
@ -392,7 +392,7 @@ public:
|
||||
}
|
||||
|
||||
static constexpr auto name = props::descriptor;
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
// NOLINTNEXTLINE(google-explicit-constructor)
|
||||
operator Type *() { return &value; }
|
||||
@ -437,7 +437,7 @@ public:
|
||||
}
|
||||
|
||||
static constexpr auto name = props::descriptor;
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
// Explicitly delete these: support python -> C++ conversion on these (i.e. these can be return
|
||||
// types but not bound arguments). We still provide them (with an explicitly delete) so that
|
||||
@ -625,7 +625,7 @@ public:
|
||||
}
|
||||
|
||||
static constexpr auto name = props::descriptor;
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
// Explicitly delete these: support python -> C++ conversion on these (i.e. these can be return
|
||||
// types but not bound arguments). We still provide them (with an explicitly delete) so that
|
||||
@ -702,7 +702,7 @@ struct type_caster<Type, enable_if_t<is_eigen_sparse<Type>::value>> {
|
||||
const_name<(Type::IsRowMajor) != 0>("scipy.sparse.csr_matrix[",
|
||||
"scipy.sparse.csc_matrix[")
|
||||
+ npy_format_descriptor<Scalar>::name + const_name("]"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
PYBIND11_NAMESPACE_END(detail)
|
||||
|
@ -124,7 +124,7 @@ public:
|
||||
const_name("Callable[[") + concat(make_caster<Args>::name...)
|
||||
+ const_name("], ") + make_caster<retval_type>::name
|
||||
+ const_name("]"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
PYBIND11_NAMESPACE_END(detail)
|
||||
|
@ -1214,7 +1214,7 @@ struct pyobject_caster<array_t<T, ExtraFlags>> {
|
||||
return src.inc_ref();
|
||||
}
|
||||
PYBIND11_TYPE_CASTER(type, handle_type_name<type>::name);
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
@ -87,7 +87,7 @@ struct set_caster {
|
||||
}
|
||||
|
||||
PYBIND11_TYPE_CASTER(type, const_name("Set[") + key_conv::name + const_name("]"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
template <typename Type, typename Key, typename Value>
|
||||
@ -137,7 +137,7 @@ struct map_caster {
|
||||
PYBIND11_TYPE_CASTER(Type,
|
||||
const_name("Dict[") + key_conv::name + const_name(", ") + value_conv::name
|
||||
+ const_name("]"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
template <typename Type, typename Value>
|
||||
@ -190,7 +190,7 @@ public:
|
||||
}
|
||||
|
||||
PYBIND11_TYPE_CASTER(Type, const_name("List[") + value_conv::name + const_name("]"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
template <typename Type, typename Alloc>
|
||||
@ -260,7 +260,7 @@ public:
|
||||
const_name("[") + const_name<Size>()
|
||||
+ const_name("]"))
|
||||
+ const_name("]"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
template <typename Type, size_t Size>
|
||||
@ -319,7 +319,7 @@ struct optional_caster {
|
||||
}
|
||||
|
||||
PYBIND11_TYPE_CASTER(Type, const_name("Optional[") + value_conv::name + const_name("]"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
#if defined(PYBIND11_HAS_OPTIONAL)
|
||||
@ -349,8 +349,7 @@ struct variant_caster_visitor {
|
||||
|
||||
template <typename T>
|
||||
result_type operator()(T &&src) const {
|
||||
if (make_caster<T>::translation_unit_local) {
|
||||
}
|
||||
PYBIND11_DETAIL_TYPE_CASTER_ACCESS_TRANSLATION_UNIT_LOCAL(T)
|
||||
return make_caster<T>::cast(std::forward<T>(src), policy, parent);
|
||||
}
|
||||
};
|
||||
@ -408,7 +407,7 @@ struct variant_caster<V<Ts...>> {
|
||||
PYBIND11_TYPE_CASTER(Type,
|
||||
const_name("Union[") + detail::concat(make_caster<Ts>::name...)
|
||||
+ const_name("]"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
#if defined(PYBIND11_HAS_VARIANT)
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
}
|
||||
|
||||
PYBIND11_TYPE_CASTER(T, const_name("os.PathLike"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
};
|
||||
|
||||
#endif // PYBIND11_HAS_FILESYSTEM || defined(PYBIND11_HAS_EXPERIMENTAL_FILESYSTEM)
|
||||
|
@ -61,7 +61,7 @@ template <>
|
||||
class type_caster<RValueCaster> {
|
||||
public:
|
||||
PYBIND11_TYPE_CASTER(RValueCaster, const_name("RValueCaster"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
static handle cast(RValueCaster &&, return_value_policy, handle) {
|
||||
return py::str("rvalue").release();
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ template <>
|
||||
class type_caster<ConstRefCasted> {
|
||||
public:
|
||||
static constexpr auto name = const_name<ConstRefCasted>();
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
// Input is unimportant, a new value will always be constructed based on the
|
||||
// cast operator.
|
||||
|
@ -106,7 +106,7 @@ PYBIND11_NAMESPACE_BEGIN(detail)
|
||||
template <>
|
||||
struct type_caster<MoveOnlyInt> {
|
||||
PYBIND11_TYPE_CASTER(MoveOnlyInt, const_name("MoveOnlyInt"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
bool load(handle src, bool) {
|
||||
value = MoveOnlyInt(src.cast<int>());
|
||||
return true;
|
||||
@ -119,7 +119,7 @@ struct type_caster<MoveOnlyInt> {
|
||||
template <>
|
||||
struct type_caster<MoveOrCopyInt> {
|
||||
PYBIND11_TYPE_CASTER(MoveOrCopyInt, const_name("MoveOrCopyInt"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
bool load(handle src, bool) {
|
||||
value = MoveOrCopyInt(src.cast<int>());
|
||||
return true;
|
||||
@ -136,7 +136,7 @@ protected:
|
||||
|
||||
public:
|
||||
static constexpr auto name = const_name("CopyOnlyInt");
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
bool load(handle src, bool) {
|
||||
value = CopyOnlyInt(src.cast<int>());
|
||||
return true;
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
#else
|
||||
PYBIND11_TYPE_CASTER(ArgInspector1, const_name("ArgInspector1"));
|
||||
#endif
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
bool load(handle src, bool convert) {
|
||||
value.arg = "loading ArgInspector1 argument " + std::string(convert ? "WITH" : "WITHOUT")
|
||||
@ -50,7 +50,7 @@ template <>
|
||||
struct type_caster<ArgInspector2> {
|
||||
public:
|
||||
PYBIND11_TYPE_CASTER(ArgInspector2, const_name("ArgInspector2"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
bool load(handle src, bool convert) {
|
||||
value.arg = "loading ArgInspector2 argument " + std::string(convert ? "WITH" : "WITHOUT")
|
||||
@ -68,7 +68,7 @@ template <>
|
||||
struct type_caster<ArgAlwaysConverts> {
|
||||
public:
|
||||
PYBIND11_TYPE_CASTER(ArgAlwaysConverts, const_name("ArgAlwaysConverts"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
|
||||
bool load(handle, bool convert) { return convert; }
|
||||
|
||||
@ -100,7 +100,7 @@ namespace detail {
|
||||
template <>
|
||||
struct type_caster<DestructionTester> {
|
||||
PYBIND11_TYPE_CASTER(DestructionTester, const_name("DestructionTester"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
bool load(handle, bool) { return true; }
|
||||
|
||||
static handle cast(const DestructionTester &, return_value_policy, handle) {
|
||||
@ -123,7 +123,7 @@ namespace py_ = ::pybind11;
|
||||
// don't have any symbol collision when using macro mixin.
|
||||
struct my_caster {
|
||||
PYBIND11_TYPE_CASTER(MyType, py_::detail::const_name("MyType"));
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1655073597;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1655073597)
|
||||
bool load(py_::handle, bool) { return true; }
|
||||
|
||||
static py_::handle cast(const MyType &, py_::return_value_policy, py_::handle) {
|
||||
|
@ -8,7 +8,7 @@ struct type_mrc {
|
||||
|
||||
struct minimal_real_caster {
|
||||
static constexpr auto name = py::detail::const_name<type_mrc>();
|
||||
static constexpr std::uint64_t universally_unique_identifier = 1000;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(1000)
|
||||
|
||||
static py::handle
|
||||
cast(type_mrc const &src, py::return_value_policy /*policy*/, py::handle /*parent*/) {
|
||||
|
@ -8,7 +8,7 @@ struct type_mrc {
|
||||
|
||||
struct minimal_real_caster {
|
||||
static constexpr auto name = py::detail::const_name<type_mrc>();
|
||||
static constexpr std::uint64_t universally_unique_identifier = 2000;
|
||||
PYBIND11_TYPE_CASTER_UNIQUE_IDENTIFIER(2000)
|
||||
|
||||
static py::handle
|
||||
cast(type_mrc const &src, py::return_value_policy /*policy*/, py::handle /*parent*/) {
|
||||
|
Loading…
Reference in New Issue
Block a user