Skip to content

Commit

Permalink
Use fully-qualified names for even clearer error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
njsmith committed May 7, 2020
1 parent b94e808 commit 4807db7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions trio/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,7 @@ def __new__(cls, name, bases, cls_namespace):
for base in bases:
if isinstance(base, Final):
raise TypeError(
"the {!r} class does not support subclassing".format(
base.__name__
)
f"{base.__module__}.{base.__qualname__} does not support subclassing"
)
return super().__new__(cls, name, bases, cls_namespace)

Expand All @@ -243,7 +241,7 @@ class SomeClass(metaclass=NoPublicConstructor):
"""
def __call__(self, *args, **kwargs):
raise TypeError(
"the {!r} class has no public constructor".format(self.__name__)
f"{self.__module__}.{self.__qualname__} has no public constructor"
)

def _create(self, *args, **kwargs):
Expand Down

0 comments on commit 4807db7

Please sign in to comment.