GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||
GeezerVison is showing github.com — [3.12] gh-111609: `end_offset` is ignored in subclasses of SyntaxError by nineteendo · Pull Request #127554 · python/cpython Conversation
|
|
@pablogsal, do you remember why this check was added in #25525? This works fine: >>> class CustomSyntaxError(SyntaxError): ... def __init__(self, msg, filename, lineno, offset, text, end_lineno, end_offset): ... self.msg = msg ... self.filename = filename ... self.lineno = lineno ... self.offset = offset ... self.text = text ... # self.end_lineno = end_lineno ... # self.end_offset = end_offset ... >>> raise CustomSyntaxError("Error message", None, 1, 5, 'a = sin(3)', 1, 9) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 1 a = sin(3) ^ CustomSyntaxError: Error message |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
What check are you referring to? The subclass check? IIRC is because some people were using some subclasses of syntax errors that were yielding weird results when displayed but I searched for the conversation and could not find anything :S |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| self.assertIn(expected, err.getvalue()) | ||
| the_exception = exc | ||
|
|
||
| def test_subclass(self): |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can we also add this test to main if is not there already?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I created a PR: #127830
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for the catch @nineteendo!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.