Skip to content

Commit

Permalink
Improve DispatcherWin32dbg's deprecation warning and raised error (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Mar 14, 2024
1 parent ad20c9b commit 1df78cf
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 @@ -236,6 +236,13 @@ def _trace_(self, *args):
win32api.OutputDebugString(str(args[-1]) + "\n")


DispatcherWin32dbg_deprecation_message = """\
The DispatcherWin32dbg dispatcher is deprecated!
Please open an issue at https://github.com/mhammond/pywin32 is this is a problem.
Comment the relevant DeprecationWarning in dispatcher.py to re-enable.\
"""


class DispatcherWin32dbg(DispatcherBase):
"""A source-level debugger dispatcher
Expand All @@ -246,10 +253,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 @@ -258,9 +266,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 1df78cf

Please sign in to comment.