New submission from Nick Coghlan <ncogh...@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.

Examples:
urllib.parse.urlparse
urllib.parse.urlunparse
urllib.parse.urljoin
urllib.parse.urlsplit
(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).

----------
assignee: ncoghlan
components: Library (Lib)
messages: 116543
nosy: ncoghlan
priority: high
severity: normal
stage: needs patch
status: open
title: Allow bytes in some APIs that use string literals internally
type: behavior
versions: Python 3.2

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

Reply via email to