diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index c65426768..c7076252c 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -257,8 +257,6 @@ the \'lazy\' dog.\n\ self.assertTrue(x is Ellipsis) self.assertRaises(SyntaxError, eval, ".. .") - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_eof_error(self): samples = ("def foo(", "\ndef foo(", "def foo(\n") for s in samples: diff --git a/parser/src/lexer.rs b/parser/src/lexer.rs index ac46b10bc..3cea29b33 100644 --- a/parser/src/lexer.rs +++ b/parser/src/lexer.rs @@ -568,7 +568,7 @@ where } else { if (c == '\n' && !triple_quoted) || (is_bytes && !c.is_ascii()) { return Err(LexicalError { - error: LexicalErrorType::StringError, + error: LexicalErrorType::Eof, location: self.get_pos(), }); } @@ -784,7 +784,7 @@ where // First of all, we need all nestings to be finished. if self.nesting > 0 { return Err(LexicalError { - error: LexicalErrorType::NestingError, + error: LexicalErrorType::Eof, location: tok_pos, }); }