homepage

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: Merge StringIO/cStringIO in 3.0
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.0
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: alexandre.vassalotti Nosy List: alexandre.vassalotti, brett.cannon, hdiogenes
Priority: release blocker Keywords: patch

Created on 2008年05月19日 20:01 by brett.cannon, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
add-stringio-1.patch alexandre.vassalotti, 2008年06月10日 02:14
add-stringio-2.patch alexandre.vassalotti, 2008年06月11日 04:22
add-stringio-3.patch alexandre.vassalotti, 2008年06月11日 22:02
Messages (5)
msg67072 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008年05月19日 20:01
PEP 3108 calls for StringIO (which is io.StringIO in 3.0) to have an 
accelerated version behind it when available. Alexandre has been working 
on this so assigning to him.
msg67886 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2008年06月10日 02:14
Here's a preliminary patch that add the C optimization for StringIO.
All tests are passing except two which depends on the StringIO.buffer
attribute of the TextIOWrapper class. Honestly, I am not sure what is
the correct way to fix this. I cannot simply "fake" the attribute by
returning a BytesIO object, since the file position of buffer is
undecidable. It seems to me that the only way to fix these failing tests
would be to define a FakeIO class, in their test file, that would wrap
ByteIO with TextIOWrapper, just like the old and inefficient StringIO.
So, any idea on what would be the best thing to do?
msg67940 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2008年06月11日 04:22
Here's another patch fixes the failing tests. I have tried to support
the buffer attribute using following hack:
 @property
 def buffer(self):
 # XXX Hack to support the buffer attribute.
 buf = codecs.getwriter(self.encoding)(BytesIO(), self.errors)
 value = self.getvalue()
 buf.write(value[:self.tell()])
 pos = buf.stream.tell()
 buf.write(value[self.tell():])
 buf.stream.seek(pos)
 return buf.stream
but this doesn't work since some application might want to modify the
buffer. So, I removed it. Another thing that bothered me were the bogus
encoding and errors arguments. So, I also removed them.
msg68028 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2008年06月11日 22:02
I updated the patch to use the new module framework.
msg68033 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2008年06月11日 23:05
Committed in r64154.
History
Date User Action Args
2022年04月11日 14:56:34adminsetgithub: 47167
2008年06月11日 23:07:45alexandre.vassalottiunlinkissue2775 dependencies
2008年06月11日 23:05:51alexandre.vassalottisetstatus: open -> closed
resolution: accepted
messages: + msg68033
2008年06月11日 22:03:43alexandre.vassalottisetfiles: + add-stringio-3.patch
messages: + msg68028
2008年06月11日 04:22:50alexandre.vassalottisetfiles: + add-stringio-2.patch
messages: + msg67940
2008年06月10日 02:14:10alexandre.vassalottisetfiles: + add-stringio-1.patch
keywords: + patch
messages: + msg67886
2008年05月29日 22:35:36hdiogenessetnosy: + hdiogenes
2008年05月19日 20:02:29brett.cannonlinkissue2775 dependencies
2008年05月19日 20:01:01brett.cannoncreate

AltStyle によって変換されたページ (->オリジナル) /