| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1673,5 +1673,15 @@ def test_debug_in_file(self): | |||
| 1673 | 1673 | self.assertEqual(stdout.decode('utf-8').strip().replace('\r\n', '\n').replace('\r', '\n'), | |
| 1674 | 1674 | "3\n=3") | |
| 1675 | 1675 | ||
| 1676 | + def test_syntax_warning_infinite_recursion_in_file(self): | ||
| 1677 | + with temp_cwd(): | ||
| 1678 | + script = 'script.py' | ||
| 1679 | + with open(script, 'w') as f: | ||
| 1680 | + f.write(r"print(f'\{1}')") | ||
| 1681 | + | ||
| 1682 | + _, stdout, stderr = assert_python_ok(script) | ||
| 1683 | + self.assertIn(rb'\1', stdout) | ||
| 1684 | + self.assertEqual(len(stderr.strip().splitlines()), 2) | ||
| 1685 | + | ||
| 1676 | 1686 | if __name__ == '__main__': | |
| 1677 | 1687 | unittest.main() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1539,6 +1539,9 @@ parser_warn(struct tok_state *tok, PyObject *category, const char *format, ...) | |||
| 1539 | 1539 | static int | |
| 1540 | 1540 | warn_invalid_escape_sequence(struct tok_state *tok, int first_invalid_escape_char) | |
| 1541 | 1541 | { | |
| 1542 | + if (!tok->report_warnings) { | ||
| 1543 | + return 0; | ||
| 1544 | + } | ||
| 1542 | 1545 | ||
| 1543 | 1546 | PyObject *msg = PyUnicode_FromFormat( | |
| 1544 | 1547 | "invalid escape sequence '\\%c'", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments