New submission from Matt Giuca <matt.gi...@gmail.com>:

urlparse contains a complete copy of the urllib.unquote function. This is 
extremely nasty code duplication -- I have two patches pending on 
urllib.unquote (#8135 and #8136) and I only just realised that I missed 
urlparse.unquote!

The reason given for this is:
"Cannot use directly from urllib as it would create circular reference.
urllib uses urlparse methods ( urljoin)"

I don't see that as a reason for code duplication. The fix is to make a local 
import of unquote in parse_qsl, like this:

def parse_qsl(qs, keep_blank_values=0, strict_parsing=0):
    from urllib import unquote

I am aware that this possibly violates PEP 8 (all imports should be at the top 
of the module), but I'd say this is the lesser of two evils.

A patch is attached. Commit log: "urlparse: Removed duplicate of 
urllib.unquote. Replaced with a local import."

----------
components: Library (Lib)
files: urlparse-unquote.patch
keywords: patch
messages: 101075
nosy: mgiuca
severity: normal
status: open
title: urlparse has a duplicate of urllib.unquote
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file16550/urlparse-unquote.patch

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

Reply via email to