[Patches] [ python-Patches-1770008 ] Remove cStringIO usage

SourceForge.net noreply at sourceforge.net
Fri Aug 10 02:49:35 CEST 2007


Patches item #1770008, was opened at 2007-08-08 14:42
Message generated for change (Comment added) made by tiran
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1770008&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 3000
>Status: Open
Resolution: Accepted
Priority: 5
Private: No
Submitted By: Christian Heimes (tiran)
Assigned to: Guido van Rossum (gvanrossum)
Summary: Remove cStringIO usage

Initial Comment:
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?



----------------------------------------------------------------------

>Comment By: Christian Heimes (tiran)
Date: 2007-08-10 02:49

Message:
Logged In: YES 
user_id=560817
Originator: YES

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


----------------------------------------------------------------------

Comment By: Alexandre Vassalotti (avassalotti)
Date: 2007-08-10 01:44

Message:
Logged In: YES 
user_id=1826340
Originator: NO

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.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2007-08-09 03:04

Message:
Logged In: YES 
user_id=6380
Originator: NO

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).

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2007-08-08 22:41

Message:
Logged In: YES 
user_id=6380
Originator: NO

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).

----------------------------------------------------------------------

Comment By: Christian Heimes (tiran)
Date: 2007-08-08 15:57

Message:
Logged In: YES 
user_id=560817
Originator: YES

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

----------------------------------------------------------------------

Comment By: Georg Brandl (gbrandl)
Date: 2007-08-08 15:06

Message:
Logged In: YES 
user_id=849994
Originator: NO

I guess that if you want to handle buffer objects, you should be using
io.BytesIO.

----------------------------------------------------------------------

Comment By: Christian Heimes (tiran)
Date: 2007-08-08 14:52

Message:
Logged In: YES 
user_id=560817
Originator: YES

File Added: stringio_deprecation.patch

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1770008&group_id=5470


More information about the Patches mailing list