In my project, I use the from __future__ import annotations syntax in my resources scripts, but when this flag is activated, the message dispatcher fails to register the message types. This is because the new annotation system converts the types to strings. The result is that I get DispatchErrors despite having registered the types.
I found a relatively simple solution, which is to add the new eval_str argument to the inspect.signature() calls in dispatch.py. I think it may only be present in 3.10 though, so maybe there would need to be an alternative for 3.9 support. This solution seems to work well for me though.
sig = inspect.signature(method, eval_str=True) # New argument here
args = list(sig.parameters.items())
In my project, I use the
from __future__ import annotations
syntax in my resources scripts, but when this flag is activated, the message dispatcher fails to register the message types. This is because the new annotation system converts the types to strings. The result is that I get DispatchErrors despite having registered the types.I found a relatively simple solution, which is to add the new
eval_str
argument to theinspect.signature()
calls in dispatch.py. I think it may only be present in 3.10 though, so maybe there would need to be an alternative for 3.9 support. This solution seems to work well for me though.