[issue8143] urlparse has a duplicate of urllib.unquote

Matt Giuca report at bugs.python.org
Mon Mar 15 03:56:09 CET 2010


Matt Giuca <matt.giuca at gmail.com> added the comment:

If this patch is rejected, then at the very least, the urllib.unquote function needs a comment at the top explaining that it is duplicated in urlparse, so any changes should be made to both.

Note that urlparse.unquote is not a documented function, or in the __all__ export list, so people *shouldn't* be using it. But OK, I'll accept that some might.

If there is a problem with some kind of race condition importing (I don't see how there could be, but I'll accept it if someone confirms), or with people using urlparse.unquote directly, then I'd propose an alternate solution which removes the circular dependency entirely: Move unquote into a separate module _urlunquote, which is imported by both urllib and urlparse. No code breakage.

Patch attached. Commit log: "Fixed duplication of urllib.unquote in urlparse. Moved function to a separate module _urlunquote."

----------
Added file: http://bugs.python.org/file16553/urlparse-unquote-newmodule.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8143>
_______________________________________


More information about the Python-bugs-list mailing list