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

Refactored itf.__dict__ to vars(itf) #641

Merged
merged 1 commit into from
Oct 14, 2024
Merged
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
17 changes: 7 additions & 10 deletions comtypes/_post_coinit/unknwn.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,16 +324,13 @@ def _make_dispmethods(self, methods: List[_DispMemberSpec]) -> None:

def __get_baseinterface_methodcount(self):
"Return the number of com methods in the base interfaces"
try:
result = 0
for itf in self.mro()[1:-1]:
result += len(itf.__dict__["_methods_"])
return result
except KeyError as err:
(name,) = err.args
if name == "_methods_":
raise TypeError("baseinterface '%s' has no _methods_" % itf.__name__)
raise
result = 0
for itf in self.mro()[1:-1]:
if "_methods_" in vars(itf):
result += len(vars(itf)["_methods_"])
else:
raise TypeError(f"baseinterface '{itf.__name__}' has no _methods_")
return result

def _make_methods(self, methods: List[_ComMemberSpec]) -> None:
if self._case_insensitive_:
Expand Down