Ticket #77 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

Warning when using XML-RPC

Reported by: olethanh Assigned to:
Priority: low Keywords:
Cc:

Description

I get these warning when doing remote call using the XML-RPC module. Exemple session : import xmlrpclib s = xmlrpclib.ServerProxy?('http://vim-fr.org/lib/exe/xmlrpc.php') s.dokuwiki.getVersion() 's' apparently modified, but can't copy it 's.dokuwiki' apparently modified, but can't copy it 'Release 2008-05-05'

I get also the following error in my terminal : Traceback (most recent call last):

File "/usr/lib/python2.6/dist-packages/reinteract/shell_view.py", line 562, in do_motion_notify_event

obj, start_line, start_offset, _,_ = buf.worksheet.get_object_at_location(line, offset)

File "/usr/lib/python2.6/dist-packages/reinteract/worksheet.py", line 717, in get_object_at_location

result_scope, include_adjacent)

File "/usr/lib/python2.6/dist-packages/reinteract/tokenized_statement.py", line 595, in get_object_at_location

obj = self.resolve_names(names, scope)

File "/usr/lib/python2.6/dist-packages/reinteract/tokenized_statement.py", line 336, in resolve_names

if obj == None:

File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in call

return self.send(self.name, args)

File "/usr/lib/python2.6/xmlrpclib.py", line 1483, in request

allow_none=self.allow_none)

File "/usr/lib/python2.6/xmlrpclib.py", line 1132, in dumps

data = m.dumps(params)

File "/usr/lib/python2.6/xmlrpclib.py", line 677, in dumps

dump(v, write)

File "/usr/lib/python2.6/xmlrpclib.py", line 699, in dump

f(self, value, write)

File "/usr/lib/python2.6/xmlrpclib.py", line 703, in dump_nil

raise TypeError?, "cannot marshal None unless allow_none is enabled"

TypeError?: cannot marshal None unless allow_none is enabled

Change History

04/02/09 23:55:14 changed by otaylor

For the second part - ugh, ugh, ugh, ugh. eq() should not be marshaled as a remote procedure call. I've gone ahead and followed the style recommendation in http://www.reinteract.org/trac/ticket/71 of using 'is None' and 'is not None' everywhere, to avoid being vulnerable to such code.

For the first, the problem is somewhat unavoidable in many cases - Reinteract can't really tell what methods mutate and what doesn't. So it guesses that if you call

<object>.<somemethod>()

And don't assign the result to anything then you probably mutated the object. However, in this particular case, since the method was called getFoo(), the non-mutation was fairly obvious. I'll try to come up with a patch to exempt methods called get_.* and get[A-Z] from being considered mutations.

(Now of course, in the xmlrpclib case, there's no way that Reinteract can record and rewind state on a remote object. xmlrpclib is inherently inimical to re-interaction. But there are certainly normal Python libraries with methods called get...()

04/03/09 00:28:41 changed by otaylor

  • status changed from new to closed.
  • resolution set to fixed.

I went with a broad approach of assuming that any method that began with 'get' 'is' or 'has' is a getter and doesn't mutate object state. That may be too broad an exemption .. we'll see.

http://git.fishsoup.net/cgit/reinteract/commit/?id=9cba9e68b1e488c1be8921dc0c9666467f334581