Skip to content

Upgrading multidict 2 to 3

Breaking2.1.6 → 3.3.2Breaking4New3Changed1Fixed5Other2

BreakingUpgrade verdict

4 breaking changes.

  • When you update a key, the new value takes the place of the last matching entry and any earlier duplicates are dropped; new keys are appended at the end.
  • Popping a key now removes just the first matching entry; a new popone() method is available.
  • Proxy objects can no longer be serialized with pickle.
  • Keys must now be strings; other key types are no longer accepted.
Top 3 of 4 that need code or config changes

Requires Python >=3.4.1 from 3.3.2 (none stated before).

Breaking4
Preserves order on multidict updates: the last entry is replaced and previous occurrences removed.
md[key] = valmd.update()
.pop() removes only the first occurrence, and .popone() is added.
.pop().popone()
Proxies are no longer picklable.
Forces keys to be str instances.

Generated by DepDelta from published Python source. Not mixed with prose notes.

  • removed: method MultiDict.clear() -> None
  • removed: method MultiDict.get(key: _S, default: Optional[_T]=…) -> _T
  • removed: method MultiDict.items() -> ItemsView[_S, _T]
  • removed: method MultiDict.keys() -> KeysView[_S]
  • removed: method MultiDict.pop(key: _S) -> _T | (key: _S, default: _T=…) -> _T
  • removed: method MultiDict.popitem() -> Tuple[_S, _T]
  • removed: method MultiDict.setdefault(key: _S, default: _T=…) -> _T
  • removed: method MultiDict.values() -> ValuesView[_T]
  • removed: method MultiDictProxy.get(key: _S, default: Optional[_T]=…) -> _T
  • removed: method MultiDictProxy.items() -> ItemsView[_S, _T]
  • removed: method MultiDictProxy.keys() -> KeysView[_S]
  • removed: method MultiDictProxy.values() -> ValuesView[_T]
  • changed: class CIMultiDict(MultiDict[_T], Generic[_T]) → class CIMultiDict(MultiDict[_T])
  • changed: class CIMultiDictProxy(MultiDictProxy[_T], Generic[_T]) → class CIMultiDictProxy(MultiDictProxy[_T])
  • changed: class MultiDict(MutableMapping[_S, _T], Generic[_T]) → class MultiDict(MutableMapping[_S, _T])
  • changed: class MultiDictProxy(Mapping[_S, _T], Generic[_T]) → class MultiDictProxy(Mapping[_S, _T])
  • added: function getversion(md: Union[MultiDict[_T], CIMultiDict[_T], MultiDictProxy[_T], CIMultiDictProxy[_T]]) -> int
  • added: method MultiDict.extend(dct: MultiDict[_T]) -> None | (map: Mapping[_S, _T]) -> None | (iterable: Iterable[Tuple[_S, _T]]) -> None
  • added: method MultiDict.popall(key: _S) -> List[_T] | (key: _S, default: _T=…) -> List[_T]
  • added: method MultiDict.popone(key: _S) -> _T | (key: _S, default: _T=…) -> _T