[issue2415] bytes() should respect __bytes__

2008-08-26 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: Thanks for the review, Barry! Committed in r66038. Sort of backported in r66039 by aliasing PyObject_Bytes to PyObject_Str. -- resolution: -> fixed status: open -> closed ___ Python tracker <[E

[issue2415] bytes() should respect __bytes__

2008-08-26 Thread Barry A. Warsaw
Barry A. Warsaw <[EMAIL PROTECTED]> added the comment: yep, that's all i meant. it might not be worth it though. ___ Python tracker <[EMAIL PROTECTED]> ___

[issue2415] bytes() should respect __bytes__

2008-08-26 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: > Should __bytes__ support be backported to 2.6? Isn't it already there in __str__? Or do you mean just add support for the alternate method name? ___ Python tracker <[EMAIL PROTECTED]>

[issue2415] bytes() should respect __bytes__

2008-08-26 Thread Barry A. Warsaw
Barry A. Warsaw <[EMAIL PROTECTED]> added the comment: Well, if I figured out how to use Rietveld correctly, I've left some questions for you in the review. It looks basically pretty good, so if you could answer those questions, you can commit the change. Should __bytes__ support be backported

[issue2415] bytes() should respect __bytes__

2008-08-21 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: Well, yes I suppose. However, I think it's a serious enough deficiency that it should block. I'll let Barry decide, though. -- assignee: -> barry ___ Python tracker <[EMAIL PROTECTED]>

[issue2415] bytes() should respect __bytes__

2008-08-21 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: Isn't it a new feature and, therefore, should wait for 3.1? -- nosy: +pitrou ___ Python tracker <[EMAIL PROTECTED]> ___ __

[issue2415] bytes() should respect __bytes__

2008-08-21 Thread Benjamin Peterson
Changes by Benjamin Peterson <[EMAIL PROTECTED]>: -- keywords: +needs review ___ Python tracker <[EMAIL PROTECTED]> ___ ___ Python-bugs-

[issue2415] bytes() should respect __bytes__

2008-08-21 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: Here's a patch. It's only implemented for bytes. Doing this for bytearray would require a bit of refactoring, and can I think wait for 3.1. I added two new C functions. PyObject_Bytes and PyBytes_FromObject. You can review it at http://code

[issue2415] bytes() should respect __bytes__

2008-08-21 Thread Benjamin Peterson
Changes by Benjamin Peterson <[EMAIL PROTECTED]>: -- priority: normal -> release blocker ___ Python tracker <[EMAIL PROTECTED]> ___ ___

[issue2415] bytes() should respect __bytes__

2008-03-19 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: I took a quick glance at this. It hinges on how the C-API is going to look. Currently, bytes is known in C as PyString and gets it's representation from __str__. Although we could just change it to __bytes__, Christian has said that he is g

[issue2415] bytes() should respect __bytes__

2008-03-18 Thread Barry A. Warsaw
New submission from Barry A. Warsaw <[EMAIL PROTECTED]>: The bytes() builtin should respect an __bytes__() converter if it exists. E.g. instead of >>> class Foo: ... def __bytes__(self): return b'foo' ... >>> bytes(Foo()) Traceback (most recent call last): File "", line 1, in TypeError: 'Fo