Skip to content

Commit

Permalink
Improve DispatcherWin32dbg DeprecationWarning
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Nov 3, 2023
1 parent f7d0a79 commit 5173008
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions com/win32com/server/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ def _trace_(self, *args):
win32api.OutputDebugString(str(args[-1]) + "\n")


DispatcherWin32dbg_deprecation_message = """\
The DispatcherWin32dbg dispatcher is deprecated!
Please let me know if this is a problem.
Comment the relevant DeprecationWarning in dispatcher.py to re-enable\
"""


class DispatcherWin32dbg(DispatcherBase):
"""A source-level debugger dispatcher
Expand All @@ -243,10 +250,11 @@ class DispatcherWin32dbg(DispatcherBase):
"""

def __init__(self, policyClass, ob):
raise DeprecationWarning(DispatcherWin32dbg_deprecation_message)
# No one uses this, and it just causes py2exe to drag all of pythonwin in.
import pywin.debugger

pywin.debugger.brk()
print("The DispatcherWin32dbg dispatcher is deprecated!")
print("Please let me know if this is a problem.")
print("Uncomment the relevant lines in dispatcher.py to re-enable")
# DEBUGGER Note - You can either:
# * Hit Run and wait for a (non Exception class) exception to occur!
# * Set a breakpoint and hit run.
Expand All @@ -255,9 +263,12 @@ def __init__(self, policyClass, ob):

def _HandleException_(self):
"""Invoke the debugger post mortem capability"""
raise DeprecationWarning(DispatcherWin32dbg_deprecation_message)
# Save details away.
typ, val, tb = exc_info()
# import pywin.debugger, pywin.debugger.dbgcon
import pywin.debugger
import pywin.debugger.dbgcon

debug = 0
try:
raise typ(val)
Expand Down

0 comments on commit 5173008

Please sign in to comment.