Skip to content

Regression in urllib.parse.parse_qsl(None) behavior #116764

Closed
@msullivan

Description

@msullivan

Bug report

Bug description:

#115771 introduced a change in some currently working behavior. Previously:

import urllib.parse
>>> urllib.parse.parse_qsl(None)
[]

but now it raises TypeError: cannot convert 'NoneType' object to bytes.

(parse_qs also broke, since it calls parse_qsl)

I think it's obviously pretty debatable whether the old behavior was desirable but there is popular code in the wild that depends on it: https://github.com/encode/httpx/blob/7df47ce4d93a06f2c3310cd692b4c2336d7663ba/httpx/_urls.py#L431-L433.

(I stumbled across this when one of my colleagues was accidentally using a current dev branch of 3.11 and started getting mysterious errors from inside the bowels of the httpx client.)

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions