Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpccall with 0-ady functions fails #130

Open
Synthetica9 opened this issue Jan 15, 2024 · 2 comments
Open

rpccall with 0-ady functions fails #130

Synthetica9 opened this issue Jan 15, 2024 · 2 comments

Comments

@Synthetica9
Copy link

Synthetica9 commented Jan 15, 2024

Description

@rpccall for functions that take no arguments throws an error when defining a function with no arguments.

To reproduce

Try to run the following file:

from p4p.rpc import rpcproxy, rpccall

@rpcproxy
class MyProxy(object):
    @rpccall("%s:foo")
    def foo():
        pass

Observed behaviour

This throws the following error:

$ python3 /tmp/p4p_rpcproxy_noargs.py 
Traceback (most recent call last):
  File "/tmp/p4p_rpcproxy_noargs.py", line 4, in <module>
    class MyProxy(object):
  File "/home/training/dev/epics-rpc-ads-proxy/p4ptest/lib/python3.8/site-packages/p4p/rpc.py", line 317, in rpcproxy
    obj[K] = _wrapMethod(K, V)
  File "/home/training/dev/epics-rpc-ads-proxy/p4ptest/lib/python3.8/site-packages/p4p/rpc.py", line 267, in _wrapMethod
    if len(S.args) != len(S.defaults):
TypeError: object of type 'NoneType' has no len()

Expected behaviour

Runs without error, allowing the user to access the function over PVA.

Synthetica9 pushed a commit to High-Voltage-Engineering/p4p that referenced this issue Jan 15, 2024
Synthetica9 added a commit to High-Voltage-Engineering/p4p that referenced this issue Jan 15, 2024
@mdavidsaver
Copy link
Member

Fixed with 4f6b9e9. Please retest with p4p==4.2.0a3.

@mdavidsaver
Copy link
Member

My added tests did trigger the same error prior to this fix, so I think I have adequately addressed this issue. Confirmation would be appreciated though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants