Move to nanobind 3.1 and release 8.0.1.3
The handle caster follows nanobind 3's renamed detail API (keep_alive_cb, NB_CALL(nb_type_put), uint32_t caster flags). Bound surface unchanged per sigdiff; list iteration ~4x faster.
This commit is contained in:
@@ -44,10 +44,10 @@ NAMESPACE_BEGIN(detail)
|
||||
inline NB_NOINLINE void
|
||||
occt_handle_keep_alive(opencascade::handle<Standard_Transient> &&h,
|
||||
PyObject *o) noexcept {
|
||||
keep_alive(o, new opencascade::handle<Standard_Transient>(std::move(h)),
|
||||
[](void *p) noexcept {
|
||||
delete (opencascade::handle<Standard_Transient> *) p;
|
||||
});
|
||||
keep_alive_cb(o, new opencascade::handle<Standard_Transient>(std::move(h)),
|
||||
[](void *p) noexcept {
|
||||
delete (opencascade::handle<Standard_Transient> *) p;
|
||||
});
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -64,7 +64,7 @@ struct type_caster<
|
||||
"Conversion of opencascade::handle<T> requires that T is "
|
||||
"bound through nanobind's regular class mechanism.");
|
||||
|
||||
bool from_python(handle src, uint8_t flags,
|
||||
bool from_python(handle src, uint32_t flags,
|
||||
cleanup_list *cleanup) noexcept {
|
||||
// A null handle is OCCT's absent value and maps to None in both
|
||||
// directions; several APIs (BRep_Tool::Surface on a degenerate edge,
|
||||
@@ -74,7 +74,7 @@ struct type_caster<
|
||||
return true;
|
||||
}
|
||||
|
||||
flags &= ~((uint8_t) cast_flags::convert);
|
||||
flags &= ~cast_flags::convert;
|
||||
|
||||
Caster caster;
|
||||
if (!caster.from_python(src, flags, cleanup))
|
||||
@@ -106,8 +106,9 @@ struct type_caster<
|
||||
// dynamic type: BRep_Tool::Surface returning a Geom_Surface handle to
|
||||
// a plane arrives in Python as Geom_Plane when that class is bound.
|
||||
bool is_new = false;
|
||||
handle result = nb_type_put_p(&typeid(Td), &typeid(*ptr), (void *) ptr,
|
||||
rv_policy::reference, cleanup, &is_new);
|
||||
handle result = NB_CALL(nb_type_put)(
|
||||
NB_CTX_C(cleanup), &typeid(Td), &typeid(*ptr), (void *) ptr,
|
||||
rv_policy::reference, cleanup, &is_new);
|
||||
|
||||
// Only a freshly created wrapper takes a reference. Attaching one per
|
||||
// conversion would pile up redundant handles on a long-lived object
|
||||
|
||||
Reference in New Issue
Block a user