Open ocmob opened 2 weeks ago
@ocmob thank you for reporting this. I have updated the reproducer to include the import numba as nb
.
The error message is
💣 zsh» python issue_9607.py
Traceback (most recent call last):
File "/Users/esc/git/numba/issue_9607.py", line 28, in <module>
func2(tup) # Fails
^^^^^^^^^^
File "/Users/vhaenel/git/numba/numba/core/dispatcher.py", line 658, in _explain_matching_error
raise TypeError(msg)
TypeError: No matching definition for argument type(s) ParamsOptional(float64, int64)
@ocmob looks like I can reproduce this. I am provisionally labelling this as a typing bug until a second maintainer can verify it, thank you for reporting.
I'd classify this as a feature request to expand support to typing.NamedTuple
. All tuple/namedtuple support predates that.
Btw, the problem is happening at unboxing. Numba needs to read into the annotations in ParamsOptional
to recognize that the second field should be a optional type.
It seems like
nb.optional
doesn't work withnb.types.NamedTuple
(it does withnb.types.Tuple
, though). Here is the minimum repro: