Issue1862
Created on 2012-03-20.20:19:10 by fwierzbicki, last changed 2013-03-22.20:26:28 by fwierzbicki.
File name |
Uploaded |
Description |
Edit |
Remove |
issue1862.patch
|
santa4nt,
2013-03-22.05:10:53
|
Support cStringIO.StringIO(array.array) |
|
|
msg6929 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2012-03-20.20:19:10 |
|
see FIXMEs
|
msg6998 (view) |
Author: Alan Kennedy (amak) |
Date: 2012-03-31.19:22:01 |
|
test_getvalue() works for me.
Did you run it again after I fixed this bug?
http://bugs.jython.org/issue1640
|
msg7003 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2012-03-31.20:35:03 |
|
I will check today, thanks! I just went through a bunch of tests and slapped FIXMEs around so that I could have a better regression test.
|
msg7736 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2013-02-25.18:17:31 |
|
Hmmm - looks like I don't have a very good definition of "today". Setting to high so it stands out on my list.
|
msg7951 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2013-03-21.21:16:20 |
|
See skipped test in our test_StringIO.py
|
msg7952 (view) |
Author: Santoso Wijaya (santa4nt) |
Date: 2013-03-22.05:10:53 |
|
Should be as simple as adding an overloaded constructor that accepts PyArray, right?
|
msg7955 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2013-03-22.16:17:12 |
|
Unfortunately not (I tried :) - apparently StringIO.StringIO and cStringIO.StringIO have very different behaviors in CPython:
Python 2.7.3 (default, Aug 1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cStringIO
>>> import StringIO
>>> import array
>>> a = array.array('B', [0,1,2])
>>> c = cStringIO(a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable
>>> c = cStringIO.StringIO(a)
>>> s = StringIO.StringIO(a)
>>> c.getvalue()
'\x00\x01\x02'
>>> s.getvalue()
"array('B', [0, 1, 2])"
Your patch will make our cStringIO act like StringIO. Seems like a CPython bug to me that they behave differently. Maybe they think so too since it looks like StringIO was dropped in Python3.
|
msg7957 (view) |
Author: Santoso Wijaya (santa4nt) |
Date: 2013-03-22.17:08:52 |
|
I noticed the same thing! See: http://bugs.python.org/issue17517
|
msg7958 (view) |
Author: Santoso Wijaya (santa4nt) |
Date: 2013-03-22.17:10:55 |
|
Note, though, that with my patch it brings Jython behavior in line with Python behavior, for 2.7.x, warts and all:
Jython 2.7b1+ (default:5554cdeb2854+, Mar 22 2013, 10:09:56)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_17
Type "help", "copyright", "credits" or "license" for more information.
>>> import array
>>> from cStringIO import StringIO
>>> a = array.array('B', [1,2,3])
>>> StringIO(a).getvalue()
'\x01\x02\x03'
>>> from StringIO import StringIO
>>> StringIO(a).getvalue()
"array('B', [1, 2, 3])"
>>>
|
msg7959 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2013-03-22.17:45:43 |
|
Oh! I shot my mouth off before actually testing the patch since it superficially looked like my first try. Thanks!
|
msg7961 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2013-03-22.20:26:28 |
|
Fixed in http://hg.python.org/jython/rev/98a58fb284f1 - thanks Santoso Wijaya!
|
|
Date |
User |
Action |
Args |
2013-03-22 20:26:28 | fwierzbicki | set | status: open -> closed resolution: fixed messages:
+ msg7961 |
2013-03-22 17:45:43 | fwierzbicki | set | messages:
+ msg7959 |
2013-03-22 17:10:55 | santa4nt | set | messages:
+ msg7958 |
2013-03-22 17:08:52 | santa4nt | set | messages:
+ msg7957 |
2013-03-22 16:17:12 | fwierzbicki | set | messages:
+ msg7955 |
2013-03-22 05:11:03 | santa4nt | set | type: behaviour |
2013-03-22 05:10:54 | santa4nt | set | files:
+ issue1862.patch keywords:
+ patch messages:
+ msg7952 nosy:
+ santa4nt |
2013-03-21 21:16:20 | fwierzbicki | set | assignee: fwierzbicki -> messages:
+ msg7951 title: test failures in test_StringIO.py -> cStringIO does not support arrays as arguments |
2013-02-25 18:17:31 | fwierzbicki | set | priority: high messages:
+ msg7736 |
2013-02-20 00:41:32 | fwierzbicki | set | assignee: fwierzbicki versions:
+ Jython 2.7, - 2.7a1 |
2012-03-31 20:35:03 | fwierzbicki | set | messages:
+ msg7003 |
2012-03-31 19:22:01 | amak | set | nosy:
+ amak messages:
+ msg6998 |
2012-03-20 20:19:10 | fwierzbicki | create | |
|