classification
Title: Remove cStringIO usage
Type: Stage:
Components: Library (Lib) Versions: Python 3.0
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: alexandre.vassalotti, christian.heimes, georg.brandl, gvanrossum
Priority: normal Keywords: patch

Created on 2007-08-08 12:42 by christian.heimes, last changed 2008-01-06 22:29 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
remove_stringio.patch christian.heimes, 2007-08-08 13:57 py3k-struni r56829
Messages (9)
msg53003 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-08-08 12:42
The patch removes the import of cStringIO from all Python files and disabled the cStringIO module. It leaves the file around.

Open problems:
* How should io.StringIO handle buffer objects?

msg53004 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-08-08 12:52
File Added: stringio_deprecation.patch
msg53005 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-08-08 13:06
I guess that if you want to handle buffer objects, you should be using io.BytesIO.
msg53006 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-08-08 13:57
The new patch also removes StringIO and adds a facade cStringIO. Importing StringIO and cStringIO is deprecated and the imports fall back to io.StringIO.
File Added: remove_stringio.patch
msg53007 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-08-08 20:41
I'll take this.  Thanks for the work!  There are a few tests that break due to this, I'll look into these.  I'll probably kill StringIO and cStringIO hard rather than adding deprecations (there's already a 2to3 fixer that fixes most StringIO references).
msg53008 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-08-09 01:04
Thanks!

Committed revision 56841.

I had to change some places to use BytesIO instead of StringIO, and I had to work hard on a few modules, esp. uu.py.  But now all tests pass (except the ones that didn't pass before).
msg53009 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2007-08-09 23:44
As George said, io.BytesIO should be used for buffer objects.

Thanks for your work, it will help me a lot for testing the new accelerator module for StringIO/BytesIO.
msg53010 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-08-10 00:49
One unit test is still import StringIO although it doesn't use it:

Index: Lib/ctypes/test/test_loading.py
===================================================================
--- Lib/ctypes/test/test_loading.py     (Revision 56879)
+++ Lib/ctypes/test/test_loading.py     (Arbeitskopie)
@@ -1,6 +1,6 @@
 from ctypes import *
 import sys, unittest
-import os, StringIO
+import os
 from ctypes.util import find_library
 from ctypes.test import is_resource_enabled
msg53011 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-08-10 01:02
Ow, thanks!

Committed revision 56880.
History
Date User Action Args
2008-01-06 22:29:45adminsetkeywords: - py3k
versions: + Python 3.0
2007-08-08 12:42:58christian.heimescreate