Skip to content
Merged
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
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ Coming in build 311, as yet unreleased
* Fixed a regression that broke special __dunder__ methods with CoClass. (#1870, #2493, @Avasam, @geppi)
* Fixed a memory leak when SafeArrays are used as out parameters (@the-snork)
* Fixed dispatch handling for properties (@the-snork)
* The following classes now produce a valid `eval` string representation when calling `repr`: (#2573, @Avasam)
* `pywin.tools.browser.HLIPythonObject`
* `win32com.server.exception.COMException`
* `win32comext.axscript.client.error.AXScriptException`
* `win32comext.axscript.client.pyscript.NamedScriptAttribute`

Build 310, released 2025/03/16
------------------------------
Expand Down
8 changes: 3 additions & 5 deletions Pythonwin/pywin/tools/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,9 @@ def __eq__(self, other):
return self.name == other.name

def __repr__(self):
try:
type = self.GetHLIType()
except:
type = "Generic"
return f"HLIPythonObject({type}) - name: {self.name} object: {self.myobject!r}"
return (
f"{self.__class__.__name__}(name={self.name!r}, object={self.myobject!r})"
)

def GetText(self):
try:
Expand Down
2 changes: 1 addition & 1 deletion com/win32com/server/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(
pythoncom.com_error.__init__(self, scode, self.description, None, -1)

def __repr__(self):
return f"<COM Exception - scode={self.scode}, desc={self.description}>"
return f"{self.__class__.__name__}(scode={self.scode!r}, desc={self.description!r})"


def IsCOMException(t=None):
Expand Down
3 changes: 0 additions & 3 deletions com/win32comext/axscript/client/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,6 @@ def ExtractTracebackInfo(self, tb: TracebackType, site: COMScript):
line = None
return filename, lineno, name, line

def __repr__(self):
return "AXScriptException Object with description:" + self.description


def ProcessAXScriptException(
scriptingSite: AXSite,
Expand Down
2 changes: 1 addition & 1 deletion com/win32comext/axscript/client/pyscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def __init__(self, scriptItem):
self.__dict__["_scriptItem_"] = scriptItem

def __repr__(self):
return f"<NamedItemAttribute{self._scriptItem_!r}>"
return f"{self.__class__.__name__}({self._scriptItem_!r})"

def __getattr__(self, attr):
# If a known subitem, return it.
Expand Down