Issue2918
Created on 2008-05-19 20:01 by brett.cannon, last changed 2008-06-11 23:05 by alexandre.vassalotti.
| msg67072 (view) |
Author: Brett Cannon (brett.cannon) |
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) |
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) |
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) |
Date: 2008-06-11 22:02 |
|
I updated the patch to use the new module framework.
|
| msg68033 (view) |
Author: Alexandre Vassalotti (alexandre.vassalotti) |
Date: 2008-06-11 23:05 |
|
Committed in r64154.
|
|
| Date |
User |
Action |
Args |
| 2008-06-11 23:07:45 | alexandre.vassalotti | unlink | issue2775 dependencies |
| 2008-06-11 23:05:51 | alexandre.vassalotti | set | status: open -> closed resolution: accepted messages:
+ msg68033 |
| 2008-06-11 22:03:43 | alexandre.vassalotti | set | files:
+ add-stringio-3.patch messages:
+ msg68028 |
| 2008-06-11 04:22:50 | alexandre.vassalotti | set | files:
+ add-stringio-2.patch messages:
+ msg67940 |
| 2008-06-10 02:14:10 | alexandre.vassalotti | set | files:
+ add-stringio-1.patch keywords:
+ patch messages:
+ msg67886 |
| 2008-05-29 22:35:36 | hdiogenes | set | nosy:
+ hdiogenes |
| 2008-05-19 20:02:29 | brett.cannon | link | issue2775 dependencies |
| 2008-05-19 20:01:01 | brett.cannon | create | |
|