This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add readinto method to StringIO and cStringIO
Type: behavior Stage:
Components: IO Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: alanjds, belopolsky, brett.cannon, silvioricardoc
Priority: normal Keywords: patch

Created on 2006-08-13 03:16 by belopolsky, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
readinto-patch.diff belopolsky, 2006-08-13 03:16 diff against revision 51240
Pull Requests
URL Status Linked Edit
PR 8451 open python-dev, 2018-07-24 19:43
Messages (5)
msg50876 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2006-08-13 03:16
Added a 'readonly' flag to buffer object constructor (needed to implement 
StringIO.readinto).
msg50877 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2006-08-24 23:04
Logged In: YES 
user_id=357491

The file object's readinto method is not meant for public
use, so adding the method to StringIO is not a good idea. 
Sorry.

Closing as rejected.
msg230550 - (view) Author: Silvio Ricardo Cordeiro (silvioricardoc) Date: 2014-11-03 19:08
BufferedReader assumes that readinto is defined, but that's not the case for StringIO's. In the end, this cripples StringIO objects, because their data can never be peek()'ed as with all other file objects.
msg322323 - (view) Author: Alan Justino (alanjds) * Date: 2018-07-24 19:07
It affects SpooledTemporaryFile too. Because it switches between StringIO, BytesIO and TemporaryFile internally. Only StringIO have not this interface.

Discovered trying to `pickle.load` a remote storage file.

Please reopen.
msg322327 - (view) Author: Alan Justino (alanjds) * Date: 2018-07-24 19:45
Issued a related PR (https://github.com/python/cpython/pull/8451) to allow SpooledTemporaryFile to propagate `readinto` calls to TemporaryFile, BytesIO or StringIO.

Of this ones, only StringIO will fail.
History
Date User Action Args
2022-04-11 14:56:19adminsetgithub: 43814
2018-07-24 19:45:24alanjdssetmessages: + msg322327
2018-07-24 19:43:20python-devsetpull_requests: + pull_request7973
2018-07-24 19:07:02alanjdssetnosy: + alanjds
messages: + msg322323
2014-11-03 19:08:56silvioricardocsetversions: + Python 2.7, Python 3.2, - Python 2.6
nosy: + silvioricardoc

messages: + msg230550

components: + IO, - Library (Lib)
type: behavior
2006-08-13 03:16:10belopolskycreate