New submission from Alexandre Vassalotti <alexan...@peadrop.com>: The documentation for PyBytes_FromObject states:
.. cfunction:: PyObject* PyBytes_FromObject(PyObject *o) Return the bytes representation of object *o* that implements the buffer protocol. However, there exists a special-case for integer object in PyBytes_FromObject that makes the function return a null-initialized bytes object. Currently, this is only used for handling `bytes(10)'. I don't like changing APIs after a stable release, but I believe this behaviour is error-prone and surprising (and darn right annoying even). So, I believe the special-case should be made specific to the bytes constructor. Thus, here is the fine patch. ---------- components: Interpreter Core files: move_int_special_case.diff keywords: 26backport, patch messages: 91483 nosy: alexandre.vassalotti priority: normal severity: normal stage: patch review status: open title: Move the special-case for integer objects out of PyBytes_FromObject. type: behavior versions: Python 3.2 Added file: http://bugs.python.org/file14693/move_int_special_case.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6687> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com