Issue 990307: cgi.parse_qsl broken - Python tracker (original) (raw)

The cgi module has been changed so that now parse_qsl("", keep_blank_values=True) returns [('', '')]. I think that's wrong. I thought about changing it so that items with empty names are skipped but test_cgi requires that "=a" produce [('', 'a')]. I also thought about special casing the empty string to return [] but test_cgi checks that parse_qsl("", strict_parsing=1) raises ValueError. That seems wrong to me but I'm scared to change it since there may be code out there that depends on this behavior. OTOH, it seems highly unlikely that people would find the strict parsing flag useful (there's too much broken stuff on the net).

The minimal fix would be to not generate any items that are equal to ('', ''). Looking for advice.