Files
macports-ports/python/py-python-jsonrpc-server/files/patch-endpoint.py.diff
T
2020-05-09 12:41:20 -04:00

64 lines
2.6 KiB
Diff

ArchLinux patch for Python 3.8 compatibility:
https://git.archlinux.org/svntogit/community.git/tree/trunk/python-3.8.patch?h=packages/python-jsonrpc-server
see also upstream PR: https://github.com/palantir/python-jsonrpc-server/pull/37
--- pyls_jsonrpc/endpoint.py.orig 2020-05-09 12:05:24.000000000 -0400
+++ pyls_jsonrpc/endpoint.py 2020-05-09 12:06:40.000000000 -0400
@@ -98,7 +98,7 @@
message (dict): The JSON RPC message sent by the client
"""
if 'jsonrpc' not in message or message['jsonrpc'] != JSONRPC_VERSION:
- log.warn("Unknown message type %s", message)
+ log.warning("Unknown message type %s", message)
return
if 'id' not in message:
@@ -135,7 +135,7 @@
try:
handler = self._dispatcher[method]
except KeyError:
- log.warn("Ignoring notification for unknown method %s", method)
+ log.warning("Ignoring notification for unknown method %s", method)
return
try:
@@ -165,7 +165,7 @@
request_future = self._client_request_futures.pop(msg_id, None)
if not request_future:
- log.warn("Received cancel notification for unknown message id %s", msg_id)
+ log.warning("Received cancel notification for unknown message id %s", msg_id)
return
# Will only work if the request hasn't started executing
@@ -230,12 +230,13 @@
request_future = self._server_request_futures.pop(msg_id, None)
if not request_future:
- log.warn("Received response to unknown message id %s", msg_id)
+ log.warning("Received response to unknown message id %s", msg_id)
return
if error is not None:
log.debug("Received error response to message %s: %s", msg_id, error)
request_future.set_exception(JsonRpcException.from_dict(error))
+ return
log.debug("Received result for message %s: %s", msg_id, result)
request_future.set_result(result)
--- test/test_endpoint.py.orig 2020-05-09 12:07:34.000000000 -0400
+++ test/test_endpoint.py 2020-05-09 12:08:18.000000000 -0400
@@ -115,9 +115,9 @@
'params': {'id': MSG_ID}
})
- with pytest.raises(exceptions.JsonRpcException) as exc_info:
+ with pytest.raises((exceptions.JsonRpcException, futures.CancelledError)) as exc_info:
assert future.result(timeout=2)
- assert exc_info.type == exceptions.JsonRpcRequestCancelled
+ assert exc_info.type in (exceptions.JsonRpcRequestCancelled, futures.CancelledError)
def test_consume_notification(endpoint, dispatcher):