Try to call a method of the referent and return a copy of the result
(self, methodname, args=(), kwds={})
| 817 | self._tls.connection = conn |
| 818 | |
| 819 | def _callmethod(self, methodname, args=(), kwds={}): |
| 820 | ''' |
| 821 | Try to call a method of the referent and return a copy of the result |
| 822 | ''' |
| 823 | try: |
| 824 | conn = self._tls.connection |
| 825 | except AttributeError: |
| 826 | util.debug('thread %r does not own a connection', |
| 827 | threading.current_thread().name) |
| 828 | self._connect() |
| 829 | conn = self._tls.connection |
| 830 | |
| 831 | conn.send((self._id, methodname, args, kwds)) |
| 832 | kind, result = conn.recv() |
| 833 | |
| 834 | if kind == '#RETURN': |
| 835 | return result |
| 836 | elif kind == '#PROXY': |
| 837 | exposed, token = result |
| 838 | proxytype = self._manager._registry[token.typeid][-1] |
| 839 | token.address = self._token.address |
| 840 | proxy = proxytype( |
| 841 | token, self._serializer, manager=self._manager, |
| 842 | authkey=self._authkey, exposed=exposed |
| 843 | ) |
| 844 | conn = self._Client(token.address, authkey=self._authkey) |
| 845 | dispatch(conn, None, 'decref', (token.id,)) |
| 846 | return proxy |
| 847 | try: |
| 848 | raise convert_to_error(kind, result) |
| 849 | finally: |
| 850 | del result # break reference cycle |
| 851 | |
| 852 | def _getvalue(self): |
| 853 | ''' |