@@ -268,17 +268,11 @@ def _marshaled_dispatch(self, data, dispatch_method = None, path = None):
268268 except Fault as fault :
269269 response = dumps (fault , allow_none = self .allow_none ,
270270 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+ )
282276
283277 return response .encode (self .encoding , 'xmlcharrefreplace' )
284278
@@ -368,16 +362,11 @@ def system_multicall(self, call_list):
368362 {'faultCode' : fault .faultCode ,
369363 'faultString' : fault .faultString }
370364 )
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+ )
381370 return results
382371
383372 def _dispatch (self , method , params ):
@@ -634,19 +623,14 @@ def _marshaled_dispatch(self, data, dispatch_method = None, path = None):
634623 try :
635624 response = self .dispatchers [path ]._marshaled_dispatch (
636625 data , dispatch_method , path )
637- except :
626+ except BaseException as exc :
638627 # report low level exception back to server
639628 # (each dispatcher should have handled their own
640629 # 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' )
650634 return response
651635
652636class CGIXMLRPCRequestHandler (SimpleXMLRPCDispatcher ):
0 commit comments