String and unicode objects allow objects that implement the buffer interface to be used in method arguments where a string is expected in most cases - but it's not completely consistent. Examples where the buffer interface is ignored include all the strip methods, the format methods, the just methods (for strings but not unicode) and the "in" operator (for strings but not unicode). The attached patch implements the missing bits.
Logged In: YES user_id=33168 Are there any doc updates necessary? If so that should be included in the patch. Tests need to be added to verify objects that implement the buffer interface works for all affected code.
Logged In: YES user_id=1105728 I don't think any doc updates are necessary. Those methods that don't need fixing don't have any documentation that is specific to objects that implement the buffer interface. Likewise for tests. I couldn't find any existing tests for objects that implement the buffer interface - maybe because the core doesn't include any objects that can be tested.
This looks like a useful addition for Python 2.x - not sure about 3.x, since that doesn't have the 2.x buffer interface anymore. Phil, could you update the patch for Python 2.7.