This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients barry, ethan.furman, mark.dickinson, ncoghlan, rhettinger, serhiy.storchaka, veky
Date 2021-09-10.07:03:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1631257439.99.0.904568595094.issue45155@roundup.psfhosted.org>
In-reply-to
Content
I'd also really like to avoid a system-dependent default. The danger is that code of the form

    some_externally_supplied_integer.to_bytes(length=4)

can be written and thoroughly tested, only to fail unexpectedly some time later when that code happens to meet a big-endian machine. In most real-world cases with input length >= 1, it's unlikely that the system byteorder is the right thing, especially for from_bytes: what you need to know is what endianness the integer was encoded with, and that's not likely to be well correlated with the endianness that the machine you're running on right now happens to be using. (The choice of default obviously doesn't matter in cases where you're encoding and decoding on the same system, but there are going to be plenty of cases where that's not true.)

This is essentially the same issue that PEP 597 starts to address with `open(filename)` with no encoding specified. That system-specific default encoding has caused us real issues in production code.
History
Date User Action Args
2021-09-10 07:04:00mark.dickinsonsetrecipients: + mark.dickinson, barry, rhettinger, ncoghlan, ethan.furman, serhiy.storchaka, veky
2021-09-10 07:03:59mark.dickinsonsetmessageid: <1631257439.99.0.904568595094.issue45155@roundup.psfhosted.org>
2021-09-10 07:03:59mark.dickinsonlinkissue45155 messages
2021-09-10 07:03:59mark.dickinsoncreate