@@ -268,17 +268,11 @@ def _marshaled_dispatch(self, data, dispatch_method = None, path = None):
268
268
except Fault as fault :
269
269
response = dumps (fault , allow_none = self .allow_none ,
270
270
encoding = self .encoding )
271
- except :
272
- # report exception back to server
273
- exc_type , exc_value , exc_tb = sys .exc_info ()
274
- try :
275
- response = dumps (
276
- Fault (1 , "%s:%s" % (exc_type , exc_value )),
277
- encoding = self .encoding , allow_none = self .allow_none ,
278
- )
279
- finally :
280
- # Break reference cycle
281
- exc_type = exc_value = exc_tb = None
271
+ except BaseException as exc :
272
+ response = dumps (
273
+ Fault (1 , "%s:%s" % (type (exc ), exc )),
274
+ encoding = self .encoding , allow_none = self .allow_none ,
275
+ )
282
276
283
277
return response .encode (self .encoding , 'xmlcharrefreplace' )
284
278
@@ -368,16 +362,11 @@ def system_multicall(self, call_list):
368
362
{'faultCode' : fault .faultCode ,
369
363
'faultString' : fault .faultString }
370
364
)
371
- except :
372
- exc_type , exc_value , exc_tb = sys .exc_info ()
373
- try :
374
- results .append (
375
- {'faultCode' : 1 ,
376
- 'faultString' : "%s:%s" % (exc_type , exc_value )}
377
- )
378
- finally :
379
- # Break reference cycle
380
- exc_type = exc_value = exc_tb = None
365
+ except BaseException as exc :
366
+ results .append (
367
+ {'faultCode' : 1 ,
368
+ 'faultString' : "%s:%s" % (type (exc ), exc )}
369
+ )
381
370
return results
382
371
383
372
def _dispatch (self , method , params ):
@@ -634,19 +623,14 @@ def _marshaled_dispatch(self, data, dispatch_method = None, path = None):
634
623
try :
635
624
response = self .dispatchers [path ]._marshaled_dispatch (
636
625
data , dispatch_method , path )
637
- except :
626
+ except BaseException as exc :
638
627
# report low level exception back to server
639
628
# (each dispatcher should have handled their own
640
629
# exceptions)
641
- exc_type , exc_value = sys .exc_info ()[:2 ]
642
- try :
643
- response = dumps (
644
- Fault (1 , "%s:%s" % (exc_type , exc_value )),
645
- encoding = self .encoding , allow_none = self .allow_none )
646
- response = response .encode (self .encoding , 'xmlcharrefreplace' )
647
- finally :
648
- # Break reference cycle
649
- exc_type = exc_value = None
630
+ response = dumps (
631
+ Fault (1 , "%s:%s" % (type (exc ), exc )),
632
+ encoding = self .encoding , allow_none = self .allow_none )
633
+ response = response .encode (self .encoding , 'xmlcharrefreplace' )
650
634
return response
651
635
652
636
class CGIXMLRPCRequestHandler (SimpleXMLRPCDispatcher ):
0 commit comments