Martin Panter added the comment:

I am torn on this. On one hand, it would be good to be consistent with the 
single-argument behaviour. But on the other hand, APIs normally accept 
arbitrary bytes-like objects (like memoryview) to minimise unnecessary copying, 
whereas this case has to make a copy to append a null terminator.

Perhaps another option is to deprecate int(byteslike) support instead, in 
favour of explicitly making a copy using bytes(byteslike). Similarly for float, 
compile, eval, exec, which also do copying thanks to Issue 24802. But 
PyNumber_Long() has called PyObject_AsCharBuffer() (predecessor of Python 3’s 
bytes-like objects) since 1.5.2 (revision 74b7213fb609). So this option would 
probably need wider discussion.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27572>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to