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
gh-98284: better error message for undefined abstractmethod #97971
Conversation
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
Lib/test/test_abc.py
Outdated
| @@ -165,7 +165,7 @@ def method_one(self): | |||
| @abc.abstractmethod | |||
| def method_two(self): | |||
| pass | |||
| msg = r"class C without an implementation for abstract methods method_one, method_two" | |||
| msg = r"class C without an implementation for abstract methods 'method_one, method_two'" | |||
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.
This is incorrect, we should quote each method individually.
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.
Thanks, done!
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
|
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
|
You do need a NEWS entry as the good knight Bedevere keeps telling you. Also, avoid force-pushing; it makes review harder. We'll squash-merge anywhere when we merge a PR. |
Done!
Noted, thanks! |
| @@ -0,0 +1,3 @@ | |||
| Improved :class:`TypeError` message for undefined abstract methods of a | |||
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.
The NEWS entry must refer to an issue, not a PR. You'll have to create an issue and rename the file to have your issue number in the file 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.
Thanks, see 4073b1f.
|
The CI failure is (most likely) unrelated: |
|
Retriggering CI, it is indeed unrelated. |
Thanks, yep that was it. |
|
Soft ping. |
| type->tp_name, | ||
| method_count > 1 ? "s" : "", | ||
| joined); | ||
| Py_DECREF(joined); | ||
| Py_DECREF(comma_w_quotes_sep); |
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.
You also need to DECREF this in the two return NULL branches above.
Come to think of it, the second of those already leaks joined. It needs a Py_DECREF(joined).
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.
Aah, yep! Fixed in 6ae052e.
Error message before:
Error message after this patch:
Given that the style-guide requires method names to be in lowercase, the quotation marks help in differentiating the sentence from the method's name.
abstractmethoddoes not highlight the undefined method name #98284