mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	Expect that source strings are Unicode.
This commit is contained in:
		
							parent
							
								
									e83395ee79
								
							
						
					
					
						commit
						98ff898c46
					
				
					 1 changed files with 10 additions and 8 deletions
				
			
		|  | @ -586,14 +586,16 @@ def runsource(self, source): | |||
|         self.more = 0 | ||||
|         self.save_warnings_filters = warnings.filters[:] | ||||
|         warnings.filterwarnings(action="error", category=SyntaxWarning) | ||||
|         if isinstance(source, types.UnicodeType): | ||||
|             from . import IOBinding | ||||
|             try: | ||||
|                 source = source.encode(IOBinding.encoding) | ||||
|             except UnicodeError: | ||||
|                 self.tkconsole.resetoutput() | ||||
|                 self.write("Unsupported characters in input\n") | ||||
|                 return | ||||
|         # at the moment, InteractiveInterpreter expects str | ||||
|         assert isinstance(source, str) | ||||
|         #if isinstance(source, str): | ||||
|         #    from . import IOBinding | ||||
|         #    try: | ||||
|         #        source = source.encode(IOBinding.encoding) | ||||
|         #    except UnicodeError: | ||||
|         #        self.tkconsole.resetoutput() | ||||
|         #        self.write("Unsupported characters in input\n") | ||||
|         #        return | ||||
|         try: | ||||
|             # InteractiveInterpreter.runsource() calls its runcode() method, | ||||
|             # which is overridden (see below) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Martin v. Löwis
						Martin v. Löwis