mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	gh-96611: Fix error message for invalid UTF-8 in mid-multiline string (#96623)
This commit is contained in:
		
							parent
							
								
									67444902a0
								
							
						
					
					
						commit
						05692c67c5
					
				
					 3 changed files with 16 additions and 0 deletions
				
			
		|  | @ -147,6 +147,18 @@ def test_error_from_string(self): | |||
|         self.assertTrue(c.exception.args[0].startswith(expected), | ||||
|                         msg=c.exception.args[0]) | ||||
| 
 | ||||
|     def test_file_parse_error_multiline(self): | ||||
|         # gh96611: | ||||
|         with open(TESTFN, "wb") as fd: | ||||
|             fd.write(b'print("""\n\xb1""")\n') | ||||
| 
 | ||||
|         try: | ||||
|             retcode, stdout, stderr = script_helper.assert_python_failure(TESTFN) | ||||
| 
 | ||||
|             self.assertGreater(retcode, 0) | ||||
|             self.assertIn(b"Non-UTF-8 code starting with '\\xb1'", stderr) | ||||
|         finally: | ||||
|             os.unlink(TESTFN) | ||||
| 
 | ||||
| class AbstractSourceEncodingTest: | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Michael Droettboom
						Michael Droettboom