[New-bugs-announce] [issue9873] Allow bytes in some APIs that use string literals internally
report at bugs.python.org
Thu Sep 16 15:25:12 CEST 2010
New submission from Nick Coghlan <ncoghlan at gmail.com>:
As per python-dev discussion in June, many Py3k APIs currently gratuitously prevent the use of bytes and bytearray objects as arguments due to their use of string literals internally.
(and plenty of other examples in urllib.parse)
While a strict reading of the relevant RFCs suggests that strings are the more appropriate type for these APIs, as a practical matter, protocol developers want to be able to operate on ASCII supersets as raw bytes.
The proposal is to modify the implementation of these functions such that string literals are used only with string arguments, and bytes literals otherwise. If a function accepts multiple values and a mixture of strings and bytes is passed in then the operation will still fail (as it should).
components: Library (Lib)
stage: needs patch
title: Allow bytes in some APIs that use string literals internally
versions: Python 3.2
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce