Skip to content

Commit 88d7c83

Browse files
committed
fix(mxsml): panic if func no found
Signed-off-by: thxCode <thxcode0824@gmail.com>
1 parent 5164e32 commit 88d7c83

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

gpustack_runtime/detector/pymxsml/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@
213213
MXSML_ERROR_MMIO_NOT_ENOUGH = 24
214214
MXSML_ERROR_GET_PCI_BRIDGE_FAILURE = 25
215215
MXSML_ERROR_LOAD_DLL_FAILURE = 26
216+
MXSML_ERROR_FUNCTION_NOT_FOUND = 999
216217

217218
_mxSmlMetaXLinkState_t = c_uint
218219
MXSML_MetaXLink_State_Enabled = 0
@@ -708,8 +709,11 @@ def _mxsmlGetFunctionPointer(name):
708709
if mxSmlLib == None:
709710
raise MXSMLError(MXSML_ERROR_FAILURE)
710711

711-
_mxsmlFunctionPointerCache[name] = getattr(mxSmlLib, name)
712-
return _mxsmlFunctionPointerCache[name]
712+
try:
713+
_mxsmlFunctionPointerCache[name] = getattr(mxSmlLib, name)
714+
return _mxsmlFunctionPointerCache[name]
715+
except AttributeError:
716+
raise MXSMLError(MXSML_ERROR_FUNCTION_NOT_FOUND)
713717

714718

715719
## string/bytes conversion for ease of use

0 commit comments

Comments
 (0)