You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
makepy generates a __str__ method, which internally calls the __call__ method. The __call__ method can take arguments, while the __str__ method does not take arguments by default - str(obj) ↔ obj.__str__().
This works incorrectly, e.g. for the COM interface of an Autocad application where __call__ requires an Index argument.
# Default method for this class is 'Item'def__call__(self, Index=defaultNamedNotOptArg):
'Gets the member object at a given index in a collection, group, or selection set'ret=self._oleobj_.InvokeTypes(0, LCID, 1, (9, 0), ((12, 1),),Index
)
ifretisnotNone:
ret=Dispatch(ret, '__call__', '{AB9F53A4-BA00-499B-BE4C-D178EC67FFCC}')
returnretdef__str__(self, *args):
returnstr(self.__call__(*args))
def__int__(self, *args):
returnint(self.__call__(*args))
the same goes for __int__.
The __str__ and __int__ methods seem unnecessary for COM interfaces.
The text was updated successfully, but these errors were encountered:
makepy generates a
__str__
method, which internally calls the__call__
method. The__call__
method can take arguments, while the__str__
method does not take arguments by default -str(obj) ↔ obj.__str__()
.pywin32/com/win32com/client/genpy.py
Lines 661 to 664 in f7d0a79
This works incorrectly, e.g. for the COM interface of an Autocad application where
__call__
requires anIndex
argument.the same goes for
__int__
.The
__str__
and__int__
methods seem unnecessary for COM interfaces.The text was updated successfully, but these errors were encountered: