Skip to content

Better error messages from Final and NoPublicConstructor#1497

Merged
pquentin merged 2 commits intopython-trio:masterfrom
njsmith:better-metaclass-error-messages
May 8, 2020
Merged

Better error messages from Final and NoPublicConstructor#1497
pquentin merged 2 commits intopython-trio:masterfrom
njsmith:better-metaclass-error-messages

Conversation

@njsmith
Copy link
Member

@njsmith njsmith commented May 6, 2020

This is a pretty trivial change, but I noticed it while working on
gh-1496 so I figured I'd just fix it.

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
Copy link

codecov bot commented May 6, 2020

Codecov Report

Merging #1497 into master will increase coverage by 6.91%.
The diff coverage is 100.00%.

@@            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     
Impacted Files Coverage Δ
trio/_core/tests/test_run.py 100.00% <100.00%> (ø)
trio/_util.py 100.00% <100.00%> (+7.50%) ⬆️
trio/tests/test_util.py 100.00% <100.00%> (ø)
trio/_sync.py 100.00% <0.00%> (ø)
trio/tests/test_sync.py 100.00% <0.00%> (ø)
trio/tests/test_testing.py 100.00% <0.00%> (+0.18%) ⬆️
trio/tests/test_highlevel_socket.py 100.00% <0.00%> (+0.63%) ⬆️
trio/_core/_run.py 99.74% <0.00%> (+0.90%) ⬆️
trio/_core/tests/test_io.py 100.00% <0.00%> (+1.75%) ⬆️
trio/tests/test_unix_pipes.py 100.00% <0.00%> (+2.06%) ⬆️
... and 23 more

trio/_util.py Outdated
raise TypeError(
"`%s` does not support subclassing" % base.__name__
"the {!r} class does not support subclassing".format(
base.__name__
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! Done.

@oremanj
Copy link
Member

oremanj commented May 6, 2020

LGTM, one optional suggestion

@njsmith
Copy link
Member Author

njsmith commented May 7, 2020

(Also, whoa, I just realized we can use f-strings now!)

@pquentin pquentin merged commit 091919b into python-trio:master May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants