@@ -264,10 +264,14 @@ def _marshaled_dispatch(self, data, dispatch_method = None, path = None):
264
264
except :
265
265
# report exception back to server
266
266
exc_type , exc_value , exc_tb = sys .exc_info ()
267
- response = dumps (
268
- Fault (1 , "%s:%s" % (exc_type , exc_value )),
269
- encoding = self .encoding , allow_none = self .allow_none ,
270
- )
267
+ try :
268
+ response = dumps (
269
+ Fault (1 , "%s:%s" % (exc_type , exc_value )),
270
+ encoding = self .encoding , allow_none = self .allow_none ,
271
+ )
272
+ finally :
273
+ # Break reference cycle
274
+ exc_type = exc_value = exc_tb = None
271
275
272
276
return response .encode (self .encoding , 'xmlcharrefreplace' )
273
277
@@ -359,10 +363,14 @@ def system_multicall(self, call_list):
359
363
)
360
364
except :
361
365
exc_type , exc_value , exc_tb = sys .exc_info ()
362
- results .append (
363
- {'faultCode' : 1 ,
364
- 'faultString' : "%s:%s" % (exc_type , exc_value )}
365
- )
366
+ try :
367
+ results .append (
368
+ {'faultCode' : 1 ,
369
+ 'faultString' : "%s:%s" % (exc_type , exc_value )}
370
+ )
371
+ finally :
372
+ # Break reference cycle
373
+ exc_type = exc_value = exc_tb = None
366
374
return results
367
375
368
376
def _dispatch (self , method , params ):
@@ -624,10 +632,14 @@ def _marshaled_dispatch(self, data, dispatch_method = None, path = None):
624
632
# (each dispatcher should have handled their own
625
633
# exceptions)
626
634
exc_type , exc_value = sys .exc_info ()[:2 ]
627
- response = dumps (
628
- Fault (1 , "%s:%s" % (exc_type , exc_value )),
629
- encoding = self .encoding , allow_none = self .allow_none )
630
- response = response .encode (self .encoding , 'xmlcharrefreplace' )
635
+ try :
636
+ response = dumps (
637
+ Fault (1 , "%s:%s" % (exc_type , exc_value )),
638
+ encoding = self .encoding , allow_none = self .allow_none )
639
+ response = response .encode (self .encoding , 'xmlcharrefreplace' )
640
+ finally :
641
+ # Break reference cycle
642
+ exc_type = exc_value = None
631
643
return response
632
644
633
645
class CGIXMLRPCRequestHandler (SimpleXMLRPCDispatcher ):
0 commit comments