Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17967/debugger
Modified Files:
Tag: py3k
__init__.py configui.py dbgcon.py debugger.py fail.py
Log Message:
Changes for Python 3
Index: fail.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/fail.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** fail.py 1 Sep 1999 23:33:41 -0000 1.1
--- fail.py 29 Aug 2008 06:16:41 -0000 1.1.4.1
***************
*** 39,43 ****
d=1
e(d)
! raise ValueError, "Hi"
def e(arg):
--- 39,43 ----
d=1
e(d)
! raise ValueError("Hi")
def e(arg):
Index: __init__.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/__init__.py,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -C2 -d -r1.5 -r1.5.4.1
*** __init__.py 1 Mar 2003 00:25:28 -0000 1.5
--- __init__.py 29 Aug 2008 06:16:41 -0000 1.5.4.1
***************
*** 13,22 ****
if isInprocApp:
# MAY Need it - may already have one
! need = sys.modules.has_key("pywin.debugger.dbgpyapp")==0
else:
need = 0
if need:
import pywin.framework.app
! import dbgpyapp
pywin.framework.app.CreateDefaultGUI(dbgpyapp.DebuggerPythonApp)
--- 13,22 ----
if isInprocApp:
# MAY Need it - may already have one
! need = ("pywin.debugger.dbgpyapp" in sys.modules)==0
else:
need = 0
if need:
import pywin.framework.app
! from . import dbgpyapp
pywin.framework.app.CreateDefaultGUI(dbgpyapp.DebuggerPythonApp)
***************
*** 34,38 ****
if currentDebugger is None:
_CheckNeedGUI()
! import debugger
currentDebugger = debugger.Debugger()
return currentDebugger
--- 34,38 ----
if currentDebugger is None:
_CheckNeedGUI()
! from . import debugger
currentDebugger = debugger.Debugger()
return currentDebugger
***************
*** 48,52 ****
return rc
except:
! print "Could not create the debugger!"
import traceback
traceback.print_exc()
--- 48,52 ----
return rc
except:
! print("Could not create the debugger!")
import traceback
traceback.print_exc()
***************
*** 64,68 ****
def runcall(*args):
! return apply(_GetCurrentDebugger().runcall, args)
def set_trace():
--- 64,68 ----
def runcall(*args):
! return _GetCurrentDebugger().runcall(*args)
def set_trace():
***************
*** 92,97 ****
t = sys.last_traceback
except AttributeError:
! print "No traceback can be found from which to perform post-mortem debugging!"
! print "No debugging can continue"
return
p = _GetCurrentDebugger()
--- 92,97 ----
t = sys.last_traceback
except AttributeError:
! print("No traceback can be found from which to perform post-mortem debugging!")
! print("No debugging can continue")
return
p = _GetCurrentDebugger()
***************
*** 100,104 ****
sys.settrace(None)
p.reset()
! while t.tb_next <> None: t = t.tb_next
p.bAtPostMortem = 1
p.prep_run(None)
--- 100,104 ----
sys.settrace(None)
p.reset()
! while t.tb_next != None: t = t.tb_next
p.bAtPostMortem = 1
p.prep_run(None)
Index: debugger.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/debugger.py,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -C2 -d -r1.17 -r1.17.2.1
*** debugger.py 9 Aug 2008 16:47:07 -0000 1.17
--- debugger.py 29 Aug 2008 06:16:41 -0000 1.17.2.1
***************
*** 29,33 ****
#import win32traceutil
! from dbgcon import *
error = "pywin.debugger.error"
--- 29,33 ----
#import win32traceutil
! from .dbgcon import *
error = "pywin.debugger.error"
***************
*** 55,59 ****
if not name or name == '?' :
# See if locals has a '__name__' (ie, a module)
! if self.myobject.f_locals.has_key('__name__'):
name = self.myobject.f_locals['__name__'] + " module"
else:
--- 55,59 ----
if not name or name == '?' :
# See if locals has a '__name__' (ie, a module)
! if '__name__' in self.myobject.f_locals:
name = self.myobject.f_locals['__name__'] + " module"
else:
***************
*** 237,241 ****
itemDetails = (commctrl.LVCFMT_LEFT, width, title, 0)
list.InsertColumn(col, itemDetails)
! parent.HookNotify( self.OnListEndLabelEdit, commctrl.LVN_ENDLABELEDIT)
parent.HookNotify(self.OnItemRightClick, commctrl.NM_RCLICK)
parent.HookNotify(self.OnItemDoubleClick, commctrl.NM_DBLCLK)
--- 237,241 ----
itemDetails = (commctrl.LVCFMT_LEFT, width, title, 0)
list.InsertColumn(col, itemDetails)
! parent.HookNotify( self.OnListEndLabelEdit, commctrl.LVN_ENDLABELEDITW)
parent.HookNotify(self.OnItemRightClick, commctrl.NM_RCLICK)
parent.HookNotify(self.OnItemDoubleClick, commctrl.NM_DBLCLK)
***************
*** 295,299 ****
def SaveState(self):
! pass
def OnListEndLabelEdit(self, std, extra):
--- 295,304 ----
def SaveState(self):
! items = []
! for i in range(self.GetItemCount()):
! items.append(self.GetItemText(i,0))
! items.append(self.GetItemText(i,1))
! win32ui.WriteProfileVal("Debugger Windows\\" + self.title, "BreakpointList", "\t".join(items))
! return 1
def OnListEndLabelEdit(self, std, extra):
***************
*** 305,309 ****
from bdb import Breakpoint
! for bplist in Breakpoint.bplist.values():
for bp in bplist:
if id(bp)==item_id:
--- 310,314 ----
from bdb import Breakpoint
! for bplist in list(Breakpoint.bplist.values()):
for bp in bplist:
if id(bp)==item_id:
***************
*** 319,323 ****
item_id = self.GetItem(num)[6]
from bdb import Breakpoint
! for bplist in Breakpoint.bplist.values():
for bp in bplist:
if id(bp)==item_id:
--- 324,328 ----
item_id = self.GetItem(num)[6]
from bdb import Breakpoint
! for bplist in list(Breakpoint.bplist.values()):
for bp in bplist:
if id(bp)==item_id:
***************
*** 329,343 ****
def RespondDebuggerData(self):
! list = self
! list.DeleteAllItems()
index = -1
from bdb import Breakpoint
! for bplist in Breakpoint.bplist.values():
for bp in bplist:
baseName = os.path.split(bp.file)[1]
cond = bp.cond
item = index+1, 0, 0, 0, str(cond), 0, id(bp)
! index = list.InsertItem(item)
! list.SetItemText(index, 1, "%s: %s" % (baseName, bp.line))
class DebuggerWatchWindow(DebuggerListViewWindow):
--- 334,348 ----
def RespondDebuggerData(self):
! l = self
! l.DeleteAllItems()
index = -1
from bdb import Breakpoint
! for bplist in list(Breakpoint.bplist.values()):
for bp in bplist:
baseName = os.path.split(bp.file)[1]
cond = bp.cond
item = index+1, 0, 0, 0, str(cond), 0, id(bp)
! index = l.InsertItem(item)
! l.SetItemText(index, 1, "%s: %s" % (baseName, bp.line))
class DebuggerWatchWindow(DebuggerListViewWindow):
***************
*** 528,532 ****
return self.options[option]
except KeyError:
! raise error, "Option %s is not a valid option" % option
def prep_run(self, cmd):
--- 533,537 ----
return self.options[option]
except KeyError:
! raise error("Option %s is not a valid option" % option)
def prep_run(self, cmd):
***************
*** 572,581 ****
self.interaction(frame, None)
! def user_exception(self, frame, (exc_type, exc_value, exc_traceback)):
# This function is called if an exception occurs,
# but only if we are to stop at or just below this level
if self.get_option(OPT_STOP_EXCEPTIONS):
frame.f_locals['__exception__'] = exc_type, exc_value
! print "Unhandled exception while debugging..."
traceback.print_exception(exc_type, exc_value, exc_traceback)
self.interaction(frame, exc_traceback)
--- 577,588 ----
self.interaction(frame, None)
! def user_exception(self, frame, exc_info):
! print ('user exception callled !!!!!!!')
# This function is called if an exception occurs,
# but only if we are to stop at or just below this level
+ (exc_type, exc_value, exc_traceback) = exc_info
if self.get_option(OPT_STOP_EXCEPTIONS):
frame.f_locals['__exception__'] = exc_type, exc_value
! print("Unhandled exception while debugging...")
traceback.print_exception(exc_type, exc_value, exc_traceback)
self.interaction(frame, exc_traceback)
***************
*** 587,597 ****
--- 594,607 ----
def stop_here(self, frame):
if self.isInitialBreakpoint:
+ print ('skip IsInitialBreakpoint')
self.isInitialBreakpoint = 0
self.set_continue()
return 0
if frame is self.botframe and self.skipBotFrame == SKIP_RUN:
+ print ('skip SKIP_RUN')
self.set_continue()
return 0
if frame is self.botframe and self.skipBotFrame == SKIP_STEP:
+ print ('skip SKIP_STEP')
self.set_step()
return 0
***************
*** 599,604 ****
def run(self, cmd,globals=None, locals=None, start_stepping = 1):
! if type(cmd) not in [types.StringType, types.CodeType]:
! raise TypeError, "Only strings can be run"
self.last_cmd_debugged = cmd
if start_stepping:
--- 609,614 ----
def run(self, cmd,globals=None, locals=None, start_stepping = 1):
! if type(cmd) not in [bytes, types.CodeType]:
! raise TypeError("Only strings can be run")
self.last_cmd_debugged = cmd
if start_stepping:
***************
*** 615,619 ****
self.prep_run(cmd)
sys.settrace(self.trace_dispatch)
! if type(cmd) <> types.CodeType:
cmd = cmd+'\n'
try:
--- 625,629 ----
self.prep_run(cmd)
sys.settrace(self.trace_dispatch)
! if type(cmd) != types.CodeType:
cmd = cmd+'\n'
try:
***************
*** 622,626 ****
else: self.skipBotFrame = SKIP_RUN
if sys.version_info > (2,2):
! exec cmd in globals, locals
else:
_doexec(cmd, globals, locals)
--- 632,636 ----
else: self.skipBotFrame = SKIP_RUN
if sys.version_info > (2,2):
! exec(cmd, globals, locals)
else:
_doexec(cmd, globals, locals)
***************
*** 647,651 ****
try:
try:
! exec what in globs, locs
except bdb.BdbQuit:
pass
--- 657,661 ----
try:
try:
! exec(what, globs, locs)
except bdb.BdbQuit:
pass
***************
*** 684,690 ****
else:
fname = "??"
! print `name`, fname, frame.f_lineno, frame
else:
! print `name`, "None"
def set_trace(self):
--- 694,700 ----
else:
fname = "??"
! print(repr(name), fname, frame.f_lineno, frame)
else:
! print(repr(name), "None")
def set_trace(self):
***************
*** 700,704 ****
# '_debugger_stop_frame_', and we dont go past it
# (everything above this is Pythonwin framework code)
! if frame.f_locals.has_key("_debugger_stop_frame_"):
self.userbotframe = frame
break
--- 710,714 ----
# '_debugger_stop_frame_', and we dont go past it
# (everything above this is Pythonwin framework code)
! if "_debugger_stop_frame_" in frame.f_locals:
self.userbotframe = frame
break
***************
*** 747,754 ****
title = " - break"
else:
! raise error, "Invalid debugger state passed!"
win32ui.GetMainFrame().SetWindowText(win32ui.LoadString(win32ui.IDR_MAINFRAME) + title)
if self.debuggerState == DBGSTATE_QUITTING and state != DBGSTATE_NOT_DEBUGGING:
! print "Ignoring state change cos Im trying to stop!", state
return
self.debuggerState = state
--- 757,764 ----
title = " - break"
else:
! raise error("Invalid debugger state passed!")
win32ui.GetMainFrame().SetWindowText(win32ui.LoadString(win32ui.IDR_MAINFRAME) + title)
if self.debuggerState == DBGSTATE_QUITTING and state != DBGSTATE_NOT_DEBUGGING:
! print("Ignoring state change cos Im trying to stop!", state)
return
self.debuggerState = state
***************
*** 815,819 ****
self.GUIAboutToInteract()
if self.pumping:
! print "!!! Already pumping - outa here"
return
self.pumping = 1
--- 825,829 ----
self.GUIAboutToInteract()
if self.pumping:
! print("!!! Already pumping - outa here")
return
self.pumping = 1
***************
*** 950,956 ****
import linecache
line = linecache.getline(filename, lineno)
! print "%s(%d): %s" % (os.path.basename(filename), lineno, line[:-1].expandtabs(4))
return 0
def _doexec(cmd, globals, locals):
! exec cmd in globals, locals
--- 960,966 ----
import linecache
line = linecache.getline(filename, lineno)
! print("%s(%d): %s" % (os.path.basename(filename), lineno, line[:-1].expandtabs(4)))
return 0
def _doexec(cmd, globals, locals):
! exec(cmd, globals, locals)
Index: configui.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/configui.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** configui.py 1 Sep 1999 23:33:41 -0000 1.1
--- configui.py 29 Aug 2008 06:16:41 -0000 1.1.4.1
***************
*** 1,3 ****
! from dbgcon import *
from pywin.mfc import dialog
--- 1,3 ----
! from .dbgcon import *
from pywin.mfc import dialog
***************
*** 17,22 ****
self.UpdateData()
dirty = 0
! for key, val in self.items():
! if self.options.has_key(key):
if self.options[key] != val:
self.options[key] = val
--- 17,22 ----
self.UpdateData()
dirty = 0
! for key, val in list(self.items()):
! if key in self.options:
if self.options[key] != val:
self.options[key] = val
Index: dbgcon.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/dbgcon.py,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -C2 -d -r1.1 -r1.1.4.1
*** dbgcon.py 1 Sep 1999 23:33:41 -0000 1.1
--- dbgcon.py 29 Aug 2008 06:16:41 -0000 1.1.4.1
***************
*** 25,28 ****
def SaveDebuggerOptions(opts):
! for key, val in opts.items():
win32ui.WriteProfileVal("Debugger Options", key, val)
--- 25,28 ----
def SaveDebuggerOptions(opts):
! for key, val in list(opts.items()):
win32ui.WriteProfileVal("Debugger Options", key, val)
|