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

Fix re-raising exceptions as QueryError in win32pdhquery.BaseQuery.open #2318

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Coming in build 307, as yet unreleased
--------------------------------------

### pywin32
* Fix re-raising exceptions as `QueryError` in `win32pdhquery.BaseQuery.open` (#2318, @Avasam)
* Add RealGetWindowClass (#2299, @CristiFati)
* Make it compile on Python 3.13 (#2260, @clin1234)
* Fixed accidentally trying to raise a `str` instead of an `Exception` in (#2270, @Avasam)
Expand Down
6 changes: 3 additions & 3 deletions win32/Lib/win32pdhquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,11 @@ def __setstate__(self, volatilecounters):
self.volatilecounters = volatilecounters


class QueryError:
def __init__(self, query):
class QueryError(Exception):
def __init__(self, query: BaseQuery):
self.query = query

def __repr__(self):
return "<Query Error in %s>" % repr(self.query)
return f"<Query Error in {self.query!r}>"

__str__ = __repr__
Loading