##// END OF EJS Templates
py3: paper over differences in future exception handling...
Augie Fackler -
r37687:1cb54e61 default
parent child Browse files
Show More
@@ -754,7 +754,8 b' class httpv2executor(object):'
754 try:
754 try:
755 result.append(decoder.decode())
755 result.append(decoder.decode())
756 except Exception:
756 except Exception:
757 f.set_exception_info(*sys.exc_info()[1:])
757 pycompat.future_set_exception_info(
758 f, sys.exc_info()[1:])
758 continue
759 continue
759 else:
760 else:
760 result.append(meta['data'])
761 result.append(meta['data'])
@@ -184,7 +184,7 b' class localcommandexecutor(object):'
184 try:
184 try:
185 result = fn(**args)
185 result = fn(**args)
186 except Exception:
186 except Exception:
187 f.set_exception_info(*sys.exc_info()[1:])
187 pycompat.future_set_exception_info(f, sys.exc_info()[1:])
188 else:
188 else:
189 f.set_result(result)
189 f.set_result(result)
190
190
@@ -28,6 +28,9 b' if not ispy3:'
28 import xmlrpclib
28 import xmlrpclib
29
29
30 from .thirdparty.concurrent import futures
30 from .thirdparty.concurrent import futures
31
32 def future_set_exception_info(f, exc_info):
33 f.set_exception_info(*exc_info)
31 else:
34 else:
32 import concurrent.futures as futures
35 import concurrent.futures as futures
33 import http.cookiejar as cookielib
36 import http.cookiejar as cookielib
@@ -37,6 +40,9 b' else:'
37 import socketserver
40 import socketserver
38 import xmlrpc.client as xmlrpclib
41 import xmlrpc.client as xmlrpclib
39
42
43 def future_set_exception_info(f, exc_info):
44 f.set_exception(exc_info[0])
45
40 empty = _queue.Empty
46 empty = _queue.Empty
41 queue = _queue.Queue
47 queue = _queue.Queue
42
48
@@ -209,7 +209,7 b' class peerexecutor(object):'
209 try:
209 try:
210 result = fn(**pycompat.strkwargs(args))
210 result = fn(**pycompat.strkwargs(args))
211 except Exception:
211 except Exception:
212 f.set_exception_info(*sys.exc_info()[1:])
212 pycompat.future_set_exception_info(f, sys.exc_info()[1:])
213 else:
213 else:
214 f.set_result(result)
214 f.set_result(result)
215
215
@@ -234,14 +234,14 b' class peerexecutor(object):'
234 batchable = fn.batchable(fn.__self__,
234 batchable = fn.batchable(fn.__self__,
235 **pycompat.strkwargs(args))
235 **pycompat.strkwargs(args))
236 except Exception:
236 except Exception:
237 f.set_exception_info(*sys.exc_info()[1:])
237 pycompat.future_set_exception_info(f, sys.exc_info()[1:])
238 return
238 return
239
239
240 # Encoded arguments and future holding remote result.
240 # Encoded arguments and future holding remote result.
241 try:
241 try:
242 encodedargs, fremote = next(batchable)
242 encodedargs, fremote = next(batchable)
243 except Exception:
243 except Exception:
244 f.set_exception_info(*sys.exc_info()[1:])
244 pycompat.future_set_exception_info(f, sys.exc_info()[1:])
245 return
245 return
246
246
247 requests.append((command, encodedargs))
247 requests.append((command, encodedargs))
@@ -304,7 +304,7 b' class peerexecutor(object):'
304 try:
304 try:
305 result = next(batchable)
305 result = next(batchable)
306 except Exception:
306 except Exception:
307 f.set_exception_info(*sys.exc_info()[1:])
307 pycompat.future_set_exception_info(f, sys.exc_info()[1:])
308 else:
308 else:
309 f.set_result(result)
309 f.set_result(result)
310
310
General Comments 0
You need to be logged in to leave comments. Login now