mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 19:34:08 +00:00 
			
		
		
		
	Fast path for IncrementalNewlineDecoder.decode() in io.TextIOWrapper.read(-1)
Copy/paste code from textiowrapper_read_chunk().
This commit is contained in:
		
							parent
							
								
									242926d227
								
							
						
					
					
						commit
						fd8211372d
					
				
					 1 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -1513,8 +1513,13 @@ textiowrapper_read(textio *self, PyObject *args)
 | 
			
		|||
        PyObject *decoded;
 | 
			
		||||
        if (bytes == NULL)
 | 
			
		||||
            goto fail;
 | 
			
		||||
        decoded = PyObject_CallMethodObjArgs(self->decoder, _PyIO_str_decode,
 | 
			
		||||
                                             bytes, Py_True, NULL);
 | 
			
		||||
 | 
			
		||||
        if (Py_TYPE(self->decoder) == &PyIncrementalNewlineDecoder_Type)
 | 
			
		||||
            decoded = _PyIncrementalNewlineDecoder_decode(self->decoder,
 | 
			
		||||
                                                          bytes, 1);
 | 
			
		||||
        else
 | 
			
		||||
            decoded = PyObject_CallMethodObjArgs(
 | 
			
		||||
                self->decoder, _PyIO_str_decode, bytes, Py_True, NULL);
 | 
			
		||||
        Py_DECREF(bytes);
 | 
			
		||||
        if (decoded == NULL)
 | 
			
		||||
            goto fail;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue