-
-
Notifications
You must be signed in to change notification settings - Fork 343
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
Better error messages from Final and NoPublicConstructor #1497
Better error messages from Final and NoPublicConstructor #1497
Conversation
This is a pretty trivial change, but I noticed it while working on python-triogh-1496 so I figured I'd just fix it.
Codecov Report
@@ Coverage Diff @@
## master #1497 +/- ##
==========================================
+ Coverage 92.76% 99.67% +6.91%
==========================================
Files 107 107
Lines 13220 13200 -20
Branches 995 995
==========================================
+ Hits 12263 13157 +894
+ Misses 904 28 -876
+ Partials 53 15 -38
|
trio/_util.py
Outdated
@@ -216,7 +216,9 @@ def __new__(cls, name, bases, cls_namespace): | |||
for base in bases: | |||
if isinstance(base, Final): | |||
raise TypeError( | |||
"`%s` does not support subclassing" % base.__name__ | |||
"the {!r} class does not support subclassing".format( | |||
base.__name__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to do {__module__}.{__qualname__}
for maximum comprehensibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Done.
LGTM, one optional suggestion |
(Also, whoa, I just realized we can use f-strings now!) |
This is a pretty trivial change, but I noticed it while working on
gh-1496 so I figured I'd just fix it.