Skip to content

Commit

Permalink
Fix re-raising exceptions as QueryError in `win32pdhquery.BaseQuery…
Browse files Browse the repository at this point in the history
….open` (#2318)
  • Loading branch information
Avasam authored Nov 11, 2024
1 parent 9806bdb commit c8c0e2d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"enableTypeIgnoreComments": true,
// Exclude from scanning when running pyright
"exclude": [
".git/",
"build/",
// Vendored
"Pythonwin/Scintilla/",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ class my_compiler(MSVCCompiler):
# worse! This can probably go away once we kill the VS project files
# though, as we can just specify the lowercase name in the module def.
_cpp_extensions = MSVCCompiler._cpp_extensions + [".CPP"]
src_extensions = MSVCCompiler.src_extensions + [".CPP"]
src_extensions = MSVCCompiler.src_extensions + [".CPP"] # type: ignore[operator] # TODO: Fix in typeshed

def link(
self,
Expand Down
6 changes: 3 additions & 3 deletions win32/Lib/win32pdhquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,11 +560,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__

0 comments on commit c8c0e2d

Please sign in to comment.