-
assigned issue to
pymoab tag_get_default_value returns NULL when tag created via pymoab with default = None
When a tag is created via pymoab tag_get_handle()
and the default value is set to None
(which is the default), then that property of the tag is initialized with NULL on the C++ side.
When the default value is requested via pymoab’s tag_get_default_value()
it returns the NULL pointer to the python code via cython.
Should this be interpreted in pymoab such that None
can be returned? or should we expect the calling code to catch this somehow? Currently it results in error: ValueError: Cannot create cython.array from NULL pointer
and I think this needs to be resolved on the pymoab side.
Comments (4)
-
reporter -
reporter Upon further inspection, MOAB’s
Core::tag_get_default_value()
should returnMB_ENTITY_NOT_FOUND
when the default value was initialized as NULL, and pymoab is setup to check and handle that, throwing aRuntimeError
. It might be that we need to handle this on the calling side, after all. -
I still like the idea of returning None if the underlying default value is a nullptr.
MB_ENTITY_NOT_FOUND
as a return error code does not make sense to me in this context. -
reporter The specific
ValueError
still makes me suspicious that this is happening before pymoab throws the exception. - Log in to comment