pallets / werkzeug

The comprehensive WSGI web application library.
https://werkzeug.palletsprojects.com
BSD 3-Clause "New" or "Revised" License
6.66k stars 1.74k forks source link

`MultiDict` behavior for nested dicts changed in 3.1.0 #2996

Closed berkanteber closed 2 weeks ago

berkanteber commented 2 weeks ago

MultiDict behavior for nested dicts changed in 3.1.0. It's probably because of this commit: 0294d88b9c10fe079ecfe9e02129d52b1e95de54.

For dicts:

So, for d = {'foo': {'bar': {'baz'}}}:

On Werkzug==3.0.4:

>>> MultiDict(d)
MultiDict([('foo', {'bar': {'baz'}})])
>>> MultiDict(d).to_dict() == d
{'foo': {'bar': {'baz'}}}

On Werkzeug==3.1.0 (and forward):

>>> MultiDict(d)
MultiDict([('foo', 'bar')])
>>> MultiDict(d).to_dict() == d
{'foo': 'bar'}

On Python 3.11, but shouldn't be relevant.

davidism commented 2 weeks ago

Duplicate of #2994