Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve DispatcherWin32dbg's deprecation warning and raised error #2145

Merged
merged 3 commits into from Mar 14, 2024

Conversation

Avasam
Copy link
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
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!

@@ -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.
Copy link
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
53 of 54 checks passed
@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.

None yet

2 participants