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.

classification
Title: urllib.quote() throws KeyError when passed an iterator
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: jafo Nosy List: benjamin.peterson, djc, jafo
Priority: normal Keywords:

Created on 2008-02-25 12:09 by djc, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg62978 - (view) Author: Dirkjan Ochtman (djc) * (Python committer) Date: 2008-02-25 12:09
>>> urllib.quote(['', 'aa'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/urllib.py", line 1205, in quote
    res = map(safe_map.__getitem__, s)
KeyError: ''

I think this is a weird error message to throw. quote() is obviously
assuming that the param passed is a one-character string iterator or
something. It should either accept just strings or come up with a better
error message when confronted with an iterator element that is not a
one-character string, IMO.
msg63010 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-02-25 22:41
Does something in the docs lead you to believe urllib.quote should
accept a list of strings? The stdlib tends to shun type-checking to make
cleaner and faster code, and let the client get exceptions like these.
msg64141 - (view) Author: Sean Reifschneider (jafo) * (Python committer) Date: 2008-03-20 03:27
Yeah, I'm going to agree that urllib's documentation is clear about it
taking a string instead of a list.
History
Date User Action Args
2022-04-11 14:56:31adminsetgithub: 46442
2008-03-20 03:27:16jafosetstatus: open -> closed
nosy: + jafo
messages: + msg64141
priority: normal
assignee: jafo
type: behavior
resolution: wont fix
2008-02-25 22:41:25benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg63010
2008-02-25 12:09:48djccreate