[Python-3000] need help fixing broken tests in py3k-pep3137 branch

Brett Cannon brett at python.org
Sat Nov 3 21:26:16 CET 2007

On 11/3/07, Christian Heimes <lists at cheimes.de> wrote:
> Adam Hupp wrote:
> > A patch for these is in http://bugs.python.org/issue1380
> >
> > One of the errors was an explicit isinstance test for bytes when the
> > actual type was buffer.  Is there a way to test for 'bytes-like'?   Is
> > the presence of a 'decode' method sufficient?
> I've applied your patch. Thank you very much!
> No, Python has no means to check for the buffer interface yet. You could
> do isinstance(ob, (bytes, buffer)) but it wouldn't catch every object.
> We could create a PyObject_CheckWriteBuffer() API function and expose
> PyObject_CheckReadBuffer() and PyObject_CheckWriteBuffer() expose them.
> Or we could abuse isinstance(ob, memoryview). Or an ABC?

An ABC would be best.  I know there was a discussion about what the
best name would be for such an ABC but I don't remember the conclusion


More information about the Python-3000 mailing list