Skip to content

Improve DispatcherWin32dbg's deprecation warning and raised error#2145

Merged
Avasam merged 3 commits intomhammond:mainfrom
Avasam:DispatcherWin32dbg
Mar 14, 2024
Merged

Improve DispatcherWin32dbg's deprecation warning and raised error#2145
Avasam merged 3 commits intomhammond:mainfrom
Avasam:DispatcherWin32dbg

Conversation

@Avasam
Copy link
Copy Markdown
Collaborator

@Avasam Avasam commented Nov 3, 2023

This used to raise without even printing the warning!

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'pywin' is not defined

I could've moved the print statements up, but instead I've improved the error by raising a DeprecationWarning with the message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
DeprecationWarning: The DispatcherWin32dbg dispatcher is deprecated!
Please let me know if this is a problem.
Comment the relevant DeprecationWarning in dispatcher.py to re-enable

Note that if you want to send an actual warning, we should use the warning module. But this used to raise an error already. It's just clearer now.

Alternatively we could just remove this class entirely if you did not get any report of users needing it.

Copy link
Copy Markdown
Owner

@mhammond mhammond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to merge after changing that text, thanks!

Comment thread com/win32com/server/dispatcher.py Outdated

DispatcherWin32dbg_deprecation_message = """\
The DispatcherWin32dbg dispatcher is deprecated!
Please let me know if this is a problem.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while we are touching this, maybe change this line to, eg, "please open an issue at https://github.com/mhammond/pywin32/ is this is a problem"?

@Avasam Avasam closed this Mar 14, 2024
@Avasam Avasam reopened this Mar 14, 2024
@Avasam Avasam merged commit 1df78cf into mhammond:main Mar 14, 2024
@Avasam Avasam deleted the DispatcherWin32dbg branch March 14, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants