[issue26759] PyBytes_FromObject accepts arbitrary iterable

2018-09-15 Thread Zackery Spytz
Zackery Spytz added the comment: I've created #34696 for PyByteArray_FromObject(). -- nosy: +ZackerySpytz ___ Python tracker ___ __

[issue26759] PyBytes_FromObject accepts arbitrary iterable

2016-04-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Other *_FromObject public API functions: PyUnicode_FromObject() -- Very strict. Accepts only str subclasses. PyByteArray_FromObject() -- Very lenient! Calls the bytearray() constructor, accepts even an integer! PyMemoryView_FromObject() -- No surprises. Accep

[issue26759] PyBytes_FromObject accepts arbitrary iterable

2016-04-14 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Note that there is alternative API function PyObject_Bytes(), that accepts > same arguments as the bytes() constructor, except an integer, and supports > the buffer protocol, the iterable protocol, and in additional supports the > __bytes__() special method.

[issue26759] PyBytes_FromObject accepts arbitrary iterable

2016-04-14 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: PyBytes_FromObject creates a bytes object from an object that implements the buffer or the iterable protocol. But only using the buffer protocol is documented. We should either document the current behavior (the documentation of int.from_bytes() can be us