New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cStringIO class name typo #49595
Comments
It has a typo error in cStringIO.StringIO's class name "StringO": >>> import cStringIO
>>> a=cStringIO.StringIO()
>>> a
<cStringIO.StringO object at 0xb7eef240>
>>> a.__class__.__name__
'StringO' So we can't unpickle the object correctly with Python 2.5.4: >>> import pickle
>>> pickle.loads(pickle.dumps(a))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.5/pickle.py", line 1366, in dumps
Pickler(file, protocol).dump(obj)
File "/usr/local/lib/python2.5/pickle.py", line 224, in dump
self.save(obj)
File "/usr/local/lib/python2.5/pickle.py", line 306, in save
rv = reduce(self.proto)
File "/usr/local/lib/python2.5/copy_reg.py", line 69, in _reduce_ex
raise TypeError, "can't pickle %s objects" % base.__name__
TypeError: can't pickle StringO objects When using multiprocess library, it also use the pickling and unpickling |
This bug also exists in Python 2.6.1 |
The documentation says: "Another difference from the StringIO module is that calling StringIO() And there seem to have been some activity about this around r33834. |
This is not a typo. cStringIO.StringIO is a factory function that Alternatively, you could upgrade to Python 2.7 or 3.0 and use |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: