Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Commit b194411

Browse files
authored
Warn on invalid octal escapes and parse-fail strings (RustPython#8686)
* Warn on invalid octal escapes and parse-fail strings Treat three-digit octal values above 0o377 as invalid escapes and scan quoted literals even when parse fails, so SyntaxWarning is emitted before a later SyntaxError. Keep warning and SyntaxError text on InvalidEscape. Enable the remaining test_string_literals invalid-escape cases. Assisted-by: Grok:4.6 * Remove expectedFailure from passing test_codeop cases test_invalid_warning and test_raw_raises_error now emit SyntaxWarning on parse-fail invalid escapes. Assisted-by: Grok:4.6 * Scan unparsed strings with token-boundary prefixes Require a complete prefix at an identifier boundary, and walk f-string interpolations separately after a parse failure. Assisted-by: Grok:4.6
1 parent 7d0a6a7 commit b194411

3 files changed

Lines changed: 492 additions & 29 deletions

File tree

‎Lib/test/test_codeop.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ def test_incomplete_warning(self, compiler):
348348
compiler("'\\e' + (")
349349
self.assertEqual(w, [])
350350

351-
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 0 != 1
352351
@subTests('compiler', RAW_COMPILERS)
353352
def test_raw_raises_error(self, compiler):
354353
warnings_cm = warnings_helper.check_warnings(
@@ -358,7 +357,6 @@ def test_raw_raises_error(self, compiler):
358357
compiler("'\\e' + (", "<input>", 'single')
359358
self.assertEqual(len(w.warnings), 1)
360359

361-
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 0 != 1
362360
@subTests('compiler', COMPILERS)
363361
def test_invalid_warning(self, compiler):
364362
with warnings.catch_warnings(record=True) as w:

‎Lib/test/test_string_literals.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def test_eval_str_incomplete(self):
105105
self.assertRaises(SyntaxError, eval, r""" '\U000000' """)
106106
self.assertRaises(SyntaxError, eval, r""" '\U0000000' """)
107107

108-
@unittest.expectedFailure # TODO: RUSTPYTHON
109108
def test_eval_str_invalid_escape(self):
110109
for b in range(1, 128):
111110
if b in b"""\n\r"'01234567NU\\abfnrtuvx""":
@@ -147,7 +146,6 @@ def test_eval_str_invalid_escape(self):
147146
self.assertRegex(str(w[0].message), 'invalid escape sequence')
148147
self.assertEqual(w[0].filename, '<string>')
149148

150-
@unittest.expectedFailure # TODO: RUSTPYTHON
151149
def test_eval_str_invalid_octal_escape(self):
152150
for i in range(0o400, 0o1000):
153151
with self.assertWarns(SyntaxWarning):
@@ -253,7 +251,6 @@ def test_eval_bytes_invalid_escape(self):
253251
self.assertEqual(exc.filename, '<string>')
254252
self.assertEqual(exc.lineno, 2)
255253

256-
@unittest.expectedFailure # TODO: RUSTPYTHON
257254
def test_eval_bytes_invalid_octal_escape(self):
258255
for i in range(0o400, 0o1000):
259256
with self.assertWarns(SyntaxWarning):

0 commit comments

Comments
 (0)