File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -2350,7 +2350,9 @@ def _is_torch_array(x):
2350
2350
# we're intentionally not attempting to import torch. If somebody
2351
2351
# has created a torch array, torch should already be in sys.modules
2352
2352
return isinstance (x , sys .modules ['torch' ].Tensor )
2353
- except Exception :
2353
+ except Exception : # TypeError, KeyError, AttributeError, maybe others?
2354
+ # we're attempting to access attributes on imported modules which
2355
+ # may have arbitrary user code, so we deliberately catch all exceptions
2354
2356
return False
2355
2357
2356
2358
@@ -2360,7 +2362,9 @@ def _is_jax_array(x):
2360
2362
# we're intentionally not attempting to import jax. If somebody
2361
2363
# has created a jax array, jax should already be in sys.modules
2362
2364
return isinstance (x , sys .modules ['jax' ].Array )
2363
- except Exception :
2365
+ except Exception : # TypeError, KeyError, AttributeError, maybe others?
2366
+ # we're attempting to access attributes on imported modules which
2367
+ # may have arbitrary user code, so we deliberately catch all exceptions
2364
2368
return False
2365
2369
2366
2370
You can’t perform that action at this time.
0 commit comments