Skip to content

PybindUUIDTypeCaster: non-UUID elements now fail the conversion.

T.J. Corona requested to merge tjcorona/smtk:fix-pybind11-typecast-error into master

This commit fixes an issue where the UUIDTypeCaster was accepting EntityRefs. When Pybind11-bound functions share the same name, they are disambiguated by sequential calls to each of the functions. Our typecaster for UUIDs was therefore being called with an incorrect input type (in this case, an EntityRef). The default casting response would have thrown a reference_cast_error, but our custom version simply assumed that its argument was a UUID. This fix guards against that action by checking for the existence of the "bytes" method in UUID, catching the resulting python exception and then throwing a reference_cast_error.

Merge request reports