[prev in list] [next in list] [prev in thread] [next in thread]
List: python-3000
Subject: Re: [Python-3000] bytearray incompatible with bytes
From: "Guido van Rossum" <guido () python ! org>
Date: 2008-08-29 16:20:16
Message-ID: ca471dc20808290920g4fc7b138gd406ee4819096d5f () mail ! gmail ! com
[Download RAW message or body]
2008/8/29 Pyry Pakkanen <pyry.pakkanen@gmail.com>:
> Hello list! First post.
Welcome!
> I ran in to this problem with ossaudiodev module when trying to copy
> the input audio to output:
>
> import ossaudiodev
> dev = ossaudiodev.open("rw")
> dev.setparameters(ossaudiodev.AFMT_S16_NE,2,44100)
> for i in range(1000): #Copy audio from input to output for a few seconds
> dev.write(dev.read(1024))
>
> It runs fine in 2.5 but in 3.0b3 it gives the following exception:
> Traceback (most recent call last):
> File "myscripts/ossthrough.py", line 5, in <module>
> dev.write(dev.read(1024))
> TypeError: write() argument 1 must be bytes or read-only buffer, not bytearray
>
> This looks like a bug. I thought bytearray is a read-only buffer.
>
> Looking at the ossaudiodev.c source it seems that
> PyArg_ParseTuple(args, "y#:write", &cp, &size) doesn't accept
> bytearrays.
There are two separate bugs here: it's true that dev.write() should
accept a bytearray instance, but dev.read() should have returned
bytes.
And yes, Aahz is right, please take a minute to register with
bugs.python.org and file a bug.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: http://mail.python.org/mailman/options/python-3000/python-3000%40progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic