Skip to content

Commit

Permalink
Remove special handling for _dispatch_call (revert #245)
Browse files Browse the repository at this point in the history
This reverts PR #245 (on issue #239).

I finally decided it's much cleaner to go for a more generic approach
where the service can easily install itself into

    conn._HANDLERS[HANDLE_CALL]

Getting a special treatment for function calls feels kind of awkward and
is unnecessary…
  • Loading branch information
coldfix committed Dec 21, 2017
1 parent 4b66aa0 commit 0cee12f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 49 deletions.
10 changes: 2 additions & 8 deletions rpyc/core/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ def __init__(self, service, channel, config = {}, _lazy = False):
self._remote_root = None
self._send_queue = []
self._local_root = service(weakref.proxy(self))
if hasattr(self._local_root, "_dispatch_call"): #See issue #239
self._dispatch_call = self._local_root._dispatch_call
if hasattr(self._local_root, "_unbox_exception"): #See PR #247
self._unbox_exception = self._local_root._unbox_exception
if not _lazy:
Expand Down Expand Up @@ -198,7 +196,6 @@ def _cleanup(self, _anyway = True):
self._local_root = None
#self._seqcounter = None
#self._config.clear()
self._dispatch_call = None
self._unbox_exception = None
del self._HANDLERS

Expand Down Expand Up @@ -591,9 +588,6 @@ def _access_attr(self, obj, name, args, overrider, param, default):
name = name2
return accessor(obj, name, *args)

def _dispatch_call(self, obj, args, kwargs):
return obj(*args, **kwargs)

#
# request handlers
#
Expand Down Expand Up @@ -643,7 +637,7 @@ def _handle_cmp(self, obj, other):
def _handle_hash(self, obj):
return hash(obj)
def _handle_call(self, obj, args, kwargs=()):
return self._dispatch_call(obj, args, dict(kwargs))
return obj(*args, **dict(kwargs))
def _handle_dir(self, obj):
return tuple(dir(obj))
def _handle_inspect(self, oid):
Expand All @@ -656,7 +650,7 @@ def _handle_setattr(self, obj, name, value):
return self._access_attr(obj, name, (value,), "_rpyc_setattr", "allow_setattr", setattr)
def _handle_callattr(self, obj, name, args, kwargs=()):
obj = self._handle_getattr(obj, name)
return self._dispatch_call(obj, args, dict(kwargs))
return self._handle_call(obj, args, kwargs)
def _handle_ctxexit(self, obj, exc):
if exc:
try:
Expand Down
41 changes: 0 additions & 41 deletions tests/test_dispatch_call.py

This file was deleted.

0 comments on commit 0cee12f

Please sign in to comment.