def do_debug(self, arg):
# this is a hack (as usual :-))
#
# inside the original do_debug, there is a call to the global "Pdb" to
# instantiate the recursive debugger: we want to intercept this call
# and instantiate *our* Pdb, passing our custom config. Therefore we
# dynamically rebind the globals.
#
def new_pdb_with_config(*args):
kwds = dict(Config=self.ConfigFactory)
return self.__class__(*args, **kwds)
newglobals = {
'Pdb': new_pdb_with_config,
'sys': sys,
}
if sys.version_info < (3, ):
do_debug_func = pdb.Pdb.do_debug.im_func
else:
do_debug_func = pdb.Pdb.do_debug
orig_do_debug = rebind_globals(do_debug_func, newglobals)
return orig_do_debug(self, arg)
评论列表
文章目录