mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Issue 13532: Allow bytearrays to be written also.
This commit is contained in:
		
							parent
							
								
									9e6bf1a8ee
								
							
						
					
					
						commit
						f8fc674f0b
					
				
					 2 changed files with 4 additions and 4 deletions
				
			
		|  | @ -1265,8 +1265,8 @@ def __init__(self, shell, tags, encoding=None): | |||
|         self.encoding = encoding | ||||
| 
 | ||||
|     def write(self, s): | ||||
|         if not isinstance(s, basestring): | ||||
|             raise TypeError('must be str, not ' + type(s).__name__) | ||||
|         if not isinstance(s, (basestring, bytearray)): | ||||
|             raise TypeError('must be string, not ' + type(s).__name__) | ||||
|         self.shell.write(s, self.tags) | ||||
| 
 | ||||
|     def writelines(self, lines): | ||||
|  |  | |||
|  | @ -263,8 +263,8 @@ def __setattr__(self, name, value): | |||
|         return setattr(self.rpc, name, value) | ||||
| 
 | ||||
|     def write(self, s): | ||||
|         if not isinstance(s, basestring): | ||||
|             raise TypeError('must be str, not ' + type(s).__name__) | ||||
|         if not isinstance(s, (basestring, bytearray)): | ||||
|             raise TypeError('must be string, not ' + type(s).__name__) | ||||
|         return self.rpc.write(s) | ||||
| 
 | ||||
| class MyHandler(rpc.RPCHandler): | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Terry Jan Reedy
						Terry Jan Reedy