remove broken code accounting an offset the size of the line #10186
This commit is contained in:
parent
8451c4b6e0
commit
503d6c5ae9
@ -289,6 +289,12 @@ class BaseExceptionReportingTests:
|
|||||||
self.assertIn('inner_raise() # Marker', blocks[2])
|
self.assertIn('inner_raise() # Marker', blocks[2])
|
||||||
self.check_zero_div(blocks[2])
|
self.check_zero_div(blocks[2])
|
||||||
|
|
||||||
|
def test_syntax_error_offset_at_eol(self):
|
||||||
|
# See #10186.
|
||||||
|
def e():
|
||||||
|
raise SyntaxError('', ('', 0, 5, 'hello'))
|
||||||
|
msg = self.get_report(e).splitlines()
|
||||||
|
self.assertEqual(msg[-2], " ^")
|
||||||
|
|
||||||
|
|
||||||
class PyExcReportingTests(BaseExceptionReportingTests, unittest.TestCase):
|
class PyExcReportingTests(BaseExceptionReportingTests, unittest.TestCase):
|
||||||
|
@ -10,6 +10,9 @@ What's New in Python 3.2 Beta 1?
|
|||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #10186: Fix the SyntaxError caret when the offset is equal to the length
|
||||||
|
of the offending line.
|
||||||
|
|
||||||
- Issue #6011: sysconfig and distutils.sysconfig use the surrogateescape error
|
- Issue #6011: sysconfig and distutils.sysconfig use the surrogateescape error
|
||||||
handler to parse the Makefile file. Avoid a UnicodeDecodeError if the source
|
handler to parse the Makefile file. Avoid a UnicodeDecodeError if the source
|
||||||
code directory name contains a non-ASCII character and the locale encoding is
|
code directory name contains a non-ASCII character and the locale encoding is
|
||||||
|
@ -1344,8 +1344,6 @@ print_error_text(PyObject *f, int offset, const char *text)
|
|||||||
{
|
{
|
||||||
char *nl;
|
char *nl;
|
||||||
if (offset >= 0) {
|
if (offset >= 0) {
|
||||||
if (offset > 0 && offset == (int)strlen(text))
|
|
||||||
offset--;
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
nl = strchr(text, '\n');
|
nl = strchr(text, '\n');
|
||||||
if (nl == NULL || nl-text >= offset)
|
if (nl == NULL || nl-text >= offset)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user