@@ -46,12 +46,12 @@ def _NumbaDeclareDecorator(input_types, return_type=None, name=None):
4646 "match_pattern" : r"(?:ROOT::)?(?:VecOps::)?RVec\w+|(?:ROOT::)?(?:VecOps::)?RVec<[\w\s]+>" ,
4747 "cpp_name" : ["ROOT::RVec" , "ROOT::VecOps::RVec" ],
4848 },
49- "std:: vector" : {
50- "match_pattern" : r"std::vector<[\w\s]+>" ,
49+ "vector" : {
50+ "match_pattern" : r"(?: std::)? vector<[\w\s]+>" ,
5151 "cpp_name" : ["std::vector" ],
5252 },
53- "std:: array" : {
54- "match_pattern" : r"std::array<[\w\s,<>]+>" ,
53+ "array" : {
54+ "match_pattern" : r"(?: std::)? array<[\w\s,<>]+>" ,
5555 "cpp_name" : ["std::array" ],
5656 },
5757 }
@@ -233,7 +233,6 @@ def inner(func, input_types=input_types, return_type=return_type, name=name):
233233 """
234234 Inner decorator without arguments, see outer decorator for documentation
235235 """
236-
237236 # Jit the given Python callable with numba
238237 try :
239238 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):
255254 "See https://cppyy.readthedocs.io/en/latest/numba.html#numba-support"
256255 )
257256 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+ )
258264 except : # noqa E722
259265 raise Exception ("Failed to jit Python callable {} with numba.jit" .format (func ))
260266 func .numba_func = nbjit
0 commit comments