Skip to content

Commit 8ed7b59

Browse files
Added warning for traversable base casting
1 parent 0ab328d commit 8ed7b59

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/python/freeze.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,7 @@ void FlatVariables::traverse_with_registry(nb::handle h, TraverseContext &ctx) {
947947
continue;
948948

949949
// WARN: very unsafe cast!
950+
// We assume, that any object added to the registry inherits from TraversableBase.
950951
auto traversable = (drjit::TraversableBase *) ptr;
951952
auto self = traversable->self_py();
952953

@@ -988,6 +989,7 @@ void FlatVariables::assign_with_registry(nb::handle dst) {
988989
continue;
989990

990991
// WARN: very unsafe cast!
992+
// We assume, that any object added to the registry inherits from TraversableBase.
991993
auto traversable = (drjit::TraversableBase *) ptr;
992994
auto self = traversable->self_py();
993995

@@ -1071,6 +1073,7 @@ static void traverse_with_registry(const char *op, TraverseCallback &tc,
10711073
continue;
10721074

10731075
// WARN: very unsafe cast!
1076+
// We assume, that any object added to the registry inherits from TraversableBase.
10741077
auto traversable = (drjit::TraversableBase *) ptr;
10751078
auto self = traversable->self_py();
10761079

@@ -1093,6 +1096,7 @@ static void traverse_with_registry(const char *op, TraverseCallback &tc,
10931096
continue;
10941097

10951098
// WARN: very unsafe cast!
1099+
// We assume, that any object added to the registry inherits from TraversableBase.
10961100
auto traversable = (drjit::TraversableBase *) ptr;
10971101
auto self = traversable->self_py();
10981102

0 commit comments

Comments
 (0)