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