Is this a bug in Python2.0 or yet another feature of Windows?
Michael Hudson
mwh21 at cam.ac.uk
Sun Oct 22 12:47:40 EDT 2000
"Fredrik Lundh" <effbot at telia.com> writes:
> "June Kim" wrote:
> > With Python 2.0 Final Release,
> >
> > >>> from array import array
> > >>> z=array('c','hello world')
> > >>> `z` #Note that these are back-quotes
> >
> > It returns a nice "python20.dll" error, whereas run on python 1.6,
> > it returns what we expect, the string form of the array.
>
> explicit calls to repr and str crashes for me with a locally built
> 2.0 interpreter (for some reason, it can still *print* this array).
Oh, that's easy: array_repr and array_print are different functions.
The culprit *seems* to be this line:
v = array_tostring(a, (PyObject *)NULL);
in array_repr, and this checkin:
--------------
revision 2.51
date: 2000/07/31 21:57:30; author: nowonder; state: Exp; lines: +39 -34
replaced PyArgs_Parse by PyArgs_ParseTuple
changed error messages for extend method from "append" to "extend"
--------------
Because PyArgs_Parse can cope with a NULL args, and PyArgs_ParseTuple
can't. Peter changed array_print, but not array_repr...
Also, we have this at present:
>>> sys.getrefcount(())
63
>>> array.array("f",[1,2])
array('f', [1.0, 2.0])
>>> sys.getrefcount(())
64
>>> array.array("f",[1,2])
array('f', [1.0, 2.0])
>>> sys.getrefcount(())
65
i.e. the current code leaks references to the empty tuple. Not
serious, but not pretty either.
> have you reported the bug? here's where to do it:
>
> http://sourceforge.net/bugs/?group_id=5470
Patch at
https://sourceforge.net/patch/index.php?func=detailpatch&patch_id=102068&group_id=5470
hopes to fix all of the above.
brown-paper-bag-ly y'rs,
M.
--
> Why are we talking about bricks and concrete in a lisp newsgroup?
After long experiment it was found preferable to talking about why
Lisp is slower than C++...
-- Duane Rettig & Tim Bradshaw, comp.lang.lisp
More information about the Python-list
mailing list