Another issue in xmlrpclib

R

Roger Binns

This was a fun problem to track down. The xmlrpclib._Method
object should do something about __str__/__repr__.

I have some code that prints out variables when an exception
happens, and if anything references one of those _Method
objects, then str/repr is called, which it tries to remote.
The real problem arises when the original exception occurred
doining some XML-RPC, so an exception is printed which when
it hits the _Method object causes another XML-RPC connection
to be made, which has an exception which when printed hits
the _Method object causes another XML-RPC connection to be
made, which has an exception which when printed ... (you get
the idea :)

I don't know what the exact right solution for this is.
Amongst the possible solutions:

- Inherit from object, which causes many Python special
methods (stuff begining with __) to be defined (I am
using this as it is the easiest)

- In getattr, refuse to work if the method name starts
with one or two underlines

- In ServerProxy.__request filter the methodname

- Do nothing

This issue could hit in other ways. For example, if
someone makes a list of XML-RPC methods (via ServerProxy)
and then sorts them, various __cmp__ like functions
would be called and sent to the remote end.

Roger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top