This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Claudiu.Popa
Recipients Claudiu.Popa, yselivanov
Date 2014-06-18.12:41:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1403095305.91.0.217669494481.issue21801@psf.upfronthosting.co.za>
In-reply-to
Content
Hello. I noticed the following behaviour while working with xmlrpc proxy methods.

>>> import inspect, xmlrpc.client
>>> proxy = xmlrpc.client.ServerProxy('http://localhost:8000')
>>> proxy.mul
<xmlrpc.client._Method object at 0x03B0C890>
>>> inspect.signature(proxy.mul)
<xmlrpc.client._Method object at 0x03B0CC90>
>>>


Now, according to the documentation, inspect.signature should return a signature or fail, but in this case it returns the actual object, which is misleading at least. This happens because _Method implements a proxy __getattr__, any accessed attribute becoming again a _Method. At the same time, inspect.signature happily uses 

try:
   obj.__signature__
except AttributeError:
   ...

to obtain the signature, if present.

The attached patch checks if __signature__ is an actual Signature object. I searched, but couldn't find any, if __signature__ can be anything, so I hope that this approach works.
History
Date User Action Args
2014-06-18 12:41:46Claudiu.Popasetrecipients: + Claudiu.Popa, yselivanov
2014-06-18 12:41:45Claudiu.Popasetmessageid: <1403095305.91.0.217669494481.issue21801@psf.upfronthosting.co.za>
2014-06-18 12:41:45Claudiu.Popalinkissue21801 messages
2014-06-18 12:41:45Claudiu.Popacreate