unstale

pypi / multidict

multidict

What changed in multidict 6 to 7, from its official release notes, upgrade guides and advisories. Sources checked 2026-12-05.

17 breaking7 security1 deprecations6 new APIs and options22 performance2 tooling24 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli 0.3.1 on npm

multidict 738 changes

Breaking changes 8

  • Creating a MultiDictProxy or CIMultiDictProxy with __new__() now requires the proxied multidict, matching the constructor and preventing a segmentation fault.

    7.2.0release notes

  • Support for Python 3.10 was dropped because it has reached end of life.

    7.2.0release notes

  • A str subclass's own lower() is no longer called to compute a key's case-insensitive identity; the identity comes from str.lower().

    7.1.0release notes

  • keys() and iteration yield each distinct key once, spelled as in its first item; items(), values(), and len(d) still include every item.

    7.1.0release notes

  • The build-time requirement is now setuptools >= 77.0 following the metadata and license metadata changes.

    7.1.0release notes

  • The C extension now raises TypeError when an argument is passed both positionally and by name, rather than silently misbehaving or ignoring surplus arguments.

    7.0.0release notes

  • The free-threaded build now requires CPython 3.14 or newer; older free-threaded interpreters fail with a clear compiler error, while GIL builds still support Python 3.10 and newer.

    7.0.0release notes

  • istr is final and can no longer be subclassed on either backend; code that subclassed it must wrap or convert instead.

    7.0.0release notes

Security 2

  • The pair is removed before result construction can run Python code that mutates the multidict, preventing a C-extension use-after-free and a pure-Python length miscount.

    7.1.0release notes

  • On Python 3.10 and 3.11, mutation during value-list allocation is refused with RuntimeError, avoiding a use-after-free.

    7.1.0release notes

Deprecations 1

  • Access emits DeprecationWarning, and the alias is removed from multidict.__all__; it is slated for removal in the next major release.

    7.1.0release notes

New APIs and options 4

  • A public C API lets third-party extensions create, read, and mutate multidicts without going through the Python-level API.

    7.0.0release notes

  • A cimport-able Cython API is available for third-party Cython modules to work with multidicts through the public API.

    7.0.0release notes

  • Provides the include path for the public C API header used by third-party extensions.

    7.0.0release notes

  • C extensions can register watchers to receive multi-value-aware notifications after a MultiDict or CIMultiDict change operation finishes.

    7.0.0release notes

Performance 13

  • Construction, update(), add(), assignment for new keys and setdefault() generally need fewer instructions or run faster; adding a new key needs about 0.5% more instructions on the GIL build.

    7.2.0release notes

  • Lookups, getall() on free-threaded builds without repeated keys, and key iteration became faster through reduced call overhead, lock avoidance and inlined lookup.

    7.2.0release notes

  • Replacing and removing items avoids redundant key identity work; deletion, assignment, pop(), duplicate-key replacement and free-threaded clear() became faster.

    7.2.0release notes

  • Mappings with exact istr keys use a compact table, taking each identity from the key's canonical form and cutting size by about 45%.

    7.1.0release notes

  • Mappings with exact str keys use a compact table without a separate identity or hash per entry; clear() allows compact storage to start again after another key requires the full layout.

    7.1.0release notes

  • Constructing a subclass of CIMultiDict got about 1% cheaper.

    7.0.0release notes

  • The C extension substantially speeds up operations keyed by plain str, including lookups, insertion, construction, extend(), and construction from a dict.

    7.0.0release notes

  • The C extension’s getall() is a little faster for keys with many values because collected values are no longer copied into a larger buffer as they accumulate.

    7.0.0release notes

  • Argument parsing in the C extension is faster for methods taking key, including their all-positional form and keyword arguments.

    7.0.0release notes

  • Constructing a subclass of MultiDict got about 1% cheaper.

    7.0.0release notes

  • The C extension improves lookup, insertion, deletion, iteration, and view-set performance; on free-threaded builds, concurrent mutations and lock-free reads are also faster.

    7.0.0release notes

  • Popping every item from a C-extension mapping now takes linear rather than quadratic time.

    7.0.0release notes

  • Key identity conversion and hashing now happen before the lock is taken, narrowing the critical section in free-threaded builds.

    7.0.0release notes

Fixes and other changes 10

  • A subclass that converts its argument in its own __init__() no longer raises TypeError before that initializer runs or starts with an empty multidict.

    7.2.1release notes

  • A huge length hint no longer raises MemoryError in extend(), update() or merge(); the C extension caps reserved room at the largest table the constructor allocates up front.

    7.2.0release notes

  • The C extension now takes case-sensitivity mode from the instance, so calling MultiDict.__init__ on a CIMultiDict does not make it case-sensitive, and CIMultiDict.__init__ accepts a MultiDict.

    7.1.0release notes

  • Fixed version values being truncated on Windows and 32-bit platforms, and a pure-Python race that could give concurrently mutated multidicts the same version.

    7.1.0release notes

  • Reinitializing a live multidict now installs its new contents and size before releasing old pairs, avoiding lost or leaked finalizer additions and incorrect length.

    7.1.0release notes

  • Python code that reads or mutates a multidict during initialization, updates, merges, deletion, popall, or related operations no longer causes crashes, lost or duplicated pairs, or backend disagreements.

    7.1.0release notes

  • The C extension now propagates MemoryError and KeyboardInterrupt raised by a positional argument's __len__ while estimating update size, matching the pure-Python backend.

    7.0.0release notes

  • Fixed a spurious RuntimeError when garbage collection mutated the multidict while getall() was building its result.

    7.0.0release notes

  • Fixed a data race on the free-threaded C extension by using relaxed atomic loads and stores for the multidict version counter.

    7.0.0release notes

  • Pure-Python MultiDict and CIMultiDict now convert canonical keys to exact str instances without invoking object.__str__() overrides, matching the C extension.

    7.0.0release notes

multidict 641 changes

Breaking changes 9

  • Calls that catch a list shrinking while it is being processed now raise RuntimeError, avoiding reads of freed memory on free-threaded builds.

    6.9.1release notes

  • Case-sensitive MultiDict no longer folds the case of istr keys and keeps them exactly as given.

    6.9.0release notes

  • In the pure-Python implementation, mutation before the first next call on an iterator now reliably raises RuntimeError, matching the C extension.

    6.9.0release notes

  • Support for free-threaded Python 3.13 has been dropped.

    6.8.0release notes

  • Extra keyword arguments are now rejected with TypeError instead of being silently ignored.

    6.8.0release notes

  • Iterator types now forbid direct instantiation, preventing a NULL internal pointer from being dereferenced by next().

    6.8.0release notes

  • Support for Python 3.9 has been dropped.

    6.8.0release notes

  • Extending a multidict with itself now doubles its contents; update(self) and merge(self) are no-ops.

    6.8.0release notes

  • Python 3.6 is no longer supported.

    6.0.0release notes

Security 5

  • Fixed freed-memory reads while iterating keys that are plain str, including when key conversion runs Python code or suspends a free-threaded critical section.

    6.9.1release notes

  • Fixed a free-threaded use-after-free when lock-free get, item lookup, or membership reads raced with a hash-table resize.

    6.9.1release notes

  • Multidict: Reference leak in CIMultiDict/MultiDict items-view union and subtraction

    6.9.1security advisoryrelease notes

  • Multidict operations are protected against data races and memory-safety failures on free-threaded CPython; selected reads are lock-free on CPython 3.14+.

    6.9.0release notes

  • Repr of multidicts, proxies, and views is protected against free-threaded data races and infinite recursion on self-referential containers.

    6.9.0release notes

New APIs and options 2

  • Added a method returning a plain dict that groups every key’s values by key identity, unlike dict(md) or a comprehension over case-insensitive keys.

    6.9.0release notes

  • The keys, values, and items views of multidicts and their proxies now support reversed() in both implementations.

    6.8.0release notes

Performance 9

  • C-extension construction uses vectorcall to avoid creating intermediate positional-argument tuples and keyword-argument dictionaries in common cases.

    6.9.0release notes

  • Adding many values for the same key is faster; each added value no longer gets slower than the one before it.

    6.9.0release notes

  • Key identity comparison in the C extension uses a faster path, giving about 15% speed-up on benchmarks with many key comparisons.

    6.8.0release notes

  • The C implementation of getall is about 10% faster.

    6.8.0release notes

  • CIMultiDict.add() is 1.5 times faster through use of METH_FASTCALL.

    6.0.0release notes

  • get*() methods receive the same performance boost from METH_FASTCALL.

    6.0.0release notes

  • MultiDict.add() is 2.2 times faster through use of METH_FASTCALL.

    6.0.0release notes

  • pop*() methods receive the same performance boost from METH_FASTCALL.

    6.0.0release notes

  • setdefault() receives the same performance boost from METH_FASTCALL.

    6.0.0release notes

Tooling 2

  • Release-tag builds now publish wheels for iOS and Android on CPython 3.13+, so downstream users on those platforms no longer need a local compiler to install multidict.

    6.8.0release notes

  • Support has been added for building and shipping riscv64 wheels.

    6.8.0release notes

Fixes and other changes 14

  • Copying or re-initializing from another multidict now assigns a new version in the C extension, matching the pure Python implementation.

    6.9.1release notes

  • Fixed a free-threaded data race between lock-free reads and freeing a retired hash table.

    6.9.1release notes

  • Fixed free-threaded concurrent writes that could lose a key, and fixed setdefault inserting a duplicate instead of recognizing an in-flight key.

    6.9.1release notes

  • Deferred decrefs until mutations finish, fixing a standard C extension segmentation fault when a value finalizer releases the GIL during mutation.

    6.9.1release notes

  • Items-view set algebra no longer corrupts or hangs when a compared value’s equality method re-enters the same MultiDict.

    6.9.0release notes

  • The pure-Python implementation is safe for concurrent use under free-threaded builds, with per-instance locking and deadlock-safe locking for two-object operations.

    6.9.0release notes

  • Feature-detection fallbacks clear only expected TypeError and AttributeError exceptions; other exceptions, including MemoryError and KeyboardInterrupt, propagate.

    6.8.0release notes

  • Fixed a segmentation fault that could be triggered when getting an item.

    6.8.0release notes

  • Calling add with only one required argument supplied by keyword no longer causes a segmentation fault.

    6.8.0release notes

  • Multidict instances created via __new__ now start as a valid empty mapping, even if __init__ is not called.

    6.8.0release notes

  • Representations of multidicts, proxies, and keys/items views now remain valid Python string literals when keys contain quote characters.

    6.8.0release notes

  • Fixed a slow memory leak by decrementing the identity value before leaving md_pop_one on success.

    6.7.1release notes

  • Multidict[int] is supported by the pure-Python version.

    6.0.0release notes

  • Type annotations for keys of multidict mapping classes are fixed.

    6.0.0release notes