@@ -46,12 +46,12 @@ def _NumbaDeclareDecorator(input_types, return_type=None, name=None):
46
46
"match_pattern" : r"(?:ROOT::)?(?:VecOps::)?RVec\w+|(?:ROOT::)?(?:VecOps::)?RVec<[\w\s]+>" ,
47
47
"cpp_name" : ["ROOT::RVec" , "ROOT::VecOps::RVec" ],
48
48
},
49
- "std:: vector" : {
50
- "match_pattern" : r"std::vector<[\w\s]+>" ,
49
+ "vector" : {
50
+ "match_pattern" : r"(?: std::)? vector<[\w\s]+>" ,
51
51
"cpp_name" : ["std::vector" ],
52
52
},
53
- "std:: array" : {
54
- "match_pattern" : r"std::array<[\w\s,<>]+>" ,
53
+ "array" : {
54
+ "match_pattern" : r"(?: std::)? array<[\w\s,<>]+>" ,
55
55
"cpp_name" : ["std::array" ],
56
56
},
57
57
}
@@ -233,7 +233,6 @@ def inner(func, input_types=input_types, return_type=return_type, name=name):
233
233
"""
234
234
Inner decorator without arguments, see outer decorator for documentation
235
235
"""
236
-
237
236
# Jit the given Python callable with numba
238
237
try :
239
238
nb_return_type , nb_input_types = get_numba_signature (input_types , return_type )
@@ -255,6 +254,13 @@ def inner(func, input_types=input_types, return_type=return_type, name=name):
255
254
"See https://cppyy.readthedocs.io/en/latest/numba.html#numba-support"
256
255
)
257
256
nbjit = nb .jit (nopython = True , inline = "always" )(func )
257
+ # In this case, the user has to explictly provide the return type, cannot be inferred
258
+ if return_type is None :
259
+ raise RuntimeError (
260
+ "Failed to infer the return type for the provided function. "
261
+ "Please specify the signature explicitly in the decorator, e.g.: "
262
+ "@ROOT.NumbaDeclare(['double'], 'double')"
263
+ )
258
264
except : # noqa E722
259
265
raise Exception ("Failed to jit Python callable {} with numba.jit" .format (func ))
260
266
func .numba_func = nbjit
0 commit comments