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 _is_same_module() on PyPy #119

Merged
merged 1 commit into from
Jan 20, 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
7 changes: 4 additions & 3 deletions overrides/signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ def _get_type_hints(callable) -> Optional[Dict]:

def _is_same_module(callable1: _WrappedMethod, callable2: _WrappedMethod2) -> bool:
mod1 = callable1.__module__.split(".")[0]
try:
mod2 = callable2.__module__
except AttributeError:
# "__module__" attribute may be missing in CPython or it can be None
# in PyPy: https://github.com/mkorpela/overrides/issues/118
mod2 = getattr(callable2, "__module__", None)
if mod2 is None:
return False
mod2 = mod2.split(".")[0]
return mod1 == mod2
Expand Down