Skip to content

fix: bump optree from 0.19.1 to 0.20.0 - #989

Merged
tobiasraabe merged 1 commit into
mainfrom
dependabot/uv/optree-0.20.0
Sep 19, 2026
Merged

tobiasraabe merged 1 commit into
mainfrom
dependabot/uv/optree-0.20.0

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Sep 8, 2026

Copy link
Copy Markdown
Contributor

Bumps optree from 0.19.1 to 0.20.0.

Release notes

Sourced from optree's releases.

optree v0.20.0

Added

  • Preserve dict insertion order on unflatten for the Python tree_flatten_one_level path mirroring the C++ path by @​XuehaiPan in #280.
  • Add built-in frozendict support for Python 3.15+ (PEP 814), with PyTreeKind.FROZENDICT, optree.treespec_frozendict(), optree.treespec.frozendict(), and optree.typing.FrozenDict by @​XuehaiPan in #274.
  • Migrate to Python_FIND_ABI for CMake's FindPython by @​XuehaiPan in #292.
  • Add Python 3.15 and Python 3.15t support by @​XuehaiPan in #293.

Changed

  • Update minimal version of typing-extensions to 4.10.0 for typing_extensions.TypeIs by @​XuehaiPan in #285.

Fixed

  • Define Py_GIL_DISABLED for free-threaded debug builds on Windows when building the C extension to work around an upstream CMake FindPython bug by @​XuehaiPan in #285.
  • Correct rare-case bugs from adversarial audit across deadlocks, caching, serialization, memory safety, and Python frontend by @​XuehaiPan in #290.
  • Fix a deadlock when registering or unregistering a pytree node concurrently with flattening, caused by releasing the GIL while holding the registry lock by @​XuehaiPan in #290.
  • Fix a deadlock when a duplicate registration or an unregistration of an unregistered type formats its error message, which runs the type's __repr__ while the registry lock is held and wedges any thread that is flattening by @​XuehaiPan in #290.
  • Fix registering an already-registered collections.namedtuple subclass or PyStructSequence emitting the override warning even though the registration is rejected, which raised UserWarning instead of ValueError under warnings-as-errors by @​XuehaiPan in #290.
  • Fix a deadlock when unregistering a pytree node drops the last reference to its flatten or unflatten function, so a __del__ or weakref callback re-entered the registry while its lock was held by @​XuehaiPan in #290.
  • Fix a deadlock while flattening on free-threading builds, caused by acquiring the non-recursive dictionary insertion order lock twice by @​XuehaiPan in #290.
  • Fix a spurious SystemError from optree._C.get_registry_size() when a concurrent registration slipped between its two reads by @​XuehaiPan in #290.
  • Fix optree.tree_iter() hanging uninterruptibly when the is_leaf predicate or a custom flatten function advances the same iterator, now reported as a RuntimeError by @​XuehaiPan in #290.
  • Fix the type caches handing an interpreter a value owned by another one, by keying them on the interpreter in addition to the type address by @​XuehaiPan in #290.
  • Fix the type caches retaining entries for a finalized interpreter, which leaked immortal keys and could be inherited by a fresh interpreter reusing the same ID by @​XuehaiPan in #290.
  • Fix a deadlock in the PyStructSequence field cache, caused by re-acquiring the GIL while still holding the cache lock by @​XuehaiPan in #290.
  • Fix the type caches publishing an entry that a failed cleanup registration would orphan, leaving a value owned by an interpreter with no callback able to evict it, whether the publish preceded that registration or raced another thread still performing it by @​XuehaiPan in #290.
  • Fix optree.structseq_fields() and the struct sequence accessors reporting the trailing hidden field names for unnamed sequence slots, by mapping each field to the slot its member offset names; the pure Python fallback, which cannot read those offsets, recovers the positions from a probe instance instead of assuming the unnamed slots trail the named ones by @​XuehaiPan in #290.
  • Fix the treespec repr printing the raw unnamed-field marker as if it were a keyword argument, now rendered as <unnamed@N> by @​XuehaiPan in #290.
  • Fix StructSequenceEntry reporting an unnamed sequence slot as field='unnamed field', which reads as a real field name, now reported by its index by @​XuehaiPan in #290.
  • Fix PyTreeSpec.__setstate__() accepting a malformed state, which could read out of bounds or abort the interpreter when the treespec was later used by @​XuehaiPan in #290.
  • Fix PyTreeSpec.__getstate__() returning the treespec's internal mutable containers, so mutating the pickled state corrupted an otherwise immutable treespec by @​XuehaiPan in #290.
  • Fix PyTreeSpec.__setstate__() borrowing the key lists from the state it was given rather than copying them, so mutating that state afterwards silently reordered the restored treespec by @​XuehaiPan in #290.
  • Fix pickling a PyTreeSpec with protocol 0 or 1 aborting the interpreter, by reducing through copyreg.__newobj__ by @​XuehaiPan in #290.
  • Fix PyTreeSpec.compose(), PyTreeSpec.broadcast_to_common_suffix(), treespec_transform(), and treespec_from_collection() silently rebinding a custom node to a different registration when an empty namespace adopted a non-empty one by @​XuehaiPan in #290.
  • Fix PyTreeSpec.broadcast_to_common_suffix() sorting the argument treespec's dictionary keys in place while building its key-mismatch error message, corrupting a treespec the caller still holds by @​XuehaiPan in #290.
  • Fix the dictionary key order being lost when a treespec built under the global namespace is promoted to an insertion-ordered namespace by @​XuehaiPan in #290.
  • Fix treespec_from_collection() on a leaf reporting an escalated UserWarning as a confusing SystemError, by checking the return value of PyErr_WarnEx() by @​XuehaiPan in #290.
  • Fix treespec_from_collection() keeping the caller's namespace on a leaf or None root, which made otherwise identical treespecs compare unequal by @​XuehaiPan in #290.
  • Fix treespec_is_prefix() and treespec_is_suffix() comparing against a stale subtree when a dictionary node's keys had been reordered by @​XuehaiPan in #290.
  • Fix the tree iterator never reporting or clearing its is_leaf predicate to the garbage collector, leaking any reference cycle that passes through it by @​XuehaiPan in #290.
  • Fix a list shrunk by an is_leaf predicate part way through flattening being read out of bounds on Python versions before 3.13.0a4, now raising IndexError by @​XuehaiPan in #290.
  • Fix a reference cycle passing through a registered custom type not being collectable once the registry no longer holds the registration, by reporting the registration's members to the garbage collector when a treespec's own nodes hold every reference to it; a cycle spanning several treespecs remains uncollectable by @​XuehaiPan in #290.
  • Fix a deeply nested treespec overflowing the native stack and crashing in treespec_paths(), treespec_accessors(), and PyTreeSpec.broadcast_to_common_suffix() instead of raising RecursionError by @​XuehaiPan in #290.
  • Fix DataclassEntry and AttrsEntry resolving an integer entry against every declared field rather than the children the registration emitted, which returned the wrong attribute for a class holding a metadata or non-init field, now read from the record register_node() leaves on the class itself by @​XuehaiPan in #290.

... (truncated)

Changelog

Sourced from optree's changelog.

[0.20.0] - 2026-08-20

Added

  • Preserve dict insertion order on unflatten for the Python tree_flatten_one_level path mirroring the C++ path by @​XuehaiPan in #280.
  • Add built-in frozendict support for Python 3.15+ (PEP 814), with PyTreeKind.FROZENDICT, optree.treespec_frozendict(), optree.treespec.frozendict(), and optree.typing.FrozenDict by @​XuehaiPan in #274.
  • Migrate to Python_FIND_ABI for CMake's FindPython by @​XuehaiPan in #292.
  • Add Python 3.15 and Python 3.15t support by @​XuehaiPan in #293.

Changed

  • Update minimal version of typing-extensions to 4.10.0 for typing_extensions.TypeIs by @​XuehaiPan in #285.

Fixed

  • Define Py_GIL_DISABLED for free-threaded debug builds on Windows when building the C extension to work around an upstream CMake FindPython bug by @​XuehaiPan in #285.
  • Fix a deadlock when registering or unregistering a pytree node concurrently with flattening, caused by releasing the GIL while holding the registry lock by @​XuehaiPan in #290.
  • Fix a deadlock when a duplicate registration or an unregistration of an unregistered type formats its error message, which runs the type's __repr__ while the registry lock is held and wedges any thread that is flattening by @​XuehaiPan in #290.
  • Fix registering an already-registered collections.namedtuple subclass or PyStructSequence emitting the override warning even though the registration is rejected, which raised UserWarning instead of ValueError under warnings-as-errors by @​XuehaiPan in #290.
  • Fix a deadlock when unregistering a pytree node drops the last reference to its flatten or unflatten function, so a __del__ or weakref callback re-entered the registry while its lock was held by @​XuehaiPan in #290.
  • Fix a deadlock while flattening on free-threading builds, caused by acquiring the non-recursive dictionary insertion order lock twice by @​XuehaiPan in #290.
  • Fix a spurious SystemError from optree._C.get_registry_size() when a concurrent registration slipped between its two reads by @​XuehaiPan in #290.
  • Fix optree.tree_iter() hanging uninterruptibly when the is_leaf predicate or a custom flatten function advances the same iterator, now reported as a RuntimeError by @​XuehaiPan in #290.
  • Fix the type caches handing an interpreter a value owned by another one, by keying them on the interpreter in addition to the type address by @​XuehaiPan in #290.
  • Fix the type caches retaining entries for a finalized interpreter, which leaked immortal keys and could be inherited by a fresh interpreter reusing the same ID by @​XuehaiPan in #290.
  • Fix a deadlock in the PyStructSequence field cache, caused by re-acquiring the GIL while still holding the cache lock by @​XuehaiPan in #290.
  • Fix the type caches publishing an entry that a failed cleanup registration would orphan, leaving a value owned by an interpreter with no callback able to evict it, whether the publish preceded that registration or raced another thread still performing it by @​XuehaiPan in #290.
  • Fix optree.structseq_fields() and the struct sequence accessors reporting the trailing hidden field names for unnamed sequence slots, by mapping each field to the slot its member offset names; the pure Python fallback, which cannot read those offsets, recovers the positions from a probe instance instead of assuming the unnamed slots trail the named ones by @​XuehaiPan in #290.
  • Fix the treespec repr printing the raw unnamed-field marker as if it were a keyword argument, now rendered as <unnamed@N> by @​XuehaiPan in #290.
  • Fix StructSequenceEntry reporting an unnamed sequence slot as field='unnamed field', which reads as a real field name, now reported by its index by @​XuehaiPan in #290.
  • Fix PyTreeSpec.__setstate__() accepting a malformed state, which could read out of bounds or abort the interpreter when the treespec was later used by @​XuehaiPan in #290.
  • Fix PyTreeSpec.__getstate__() returning the treespec's internal mutable containers, so mutating the pickled state corrupted an otherwise immutable treespec by @​XuehaiPan in #290.
  • Fix PyTreeSpec.__setstate__() borrowing the key lists from the state it was given rather than copying them, so mutating that state afterwards silently reordered the restored treespec by @​XuehaiPan in #290.
  • Fix pickling a PyTreeSpec with protocol 0 or 1 aborting the interpreter, by reducing through copyreg.__newobj__ by @​XuehaiPan in #290.
  • Fix PyTreeSpec.compose(), PyTreeSpec.broadcast_to_common_suffix(), treespec_transform(), and treespec_from_collection() silently rebinding a custom node to a different registration when an empty namespace adopted a non-empty one by @​XuehaiPan in #290.
  • Fix PyTreeSpec.broadcast_to_common_suffix() sorting the argument treespec's dictionary keys in place while building its key-mismatch error message, corrupting a treespec the caller still holds by @​XuehaiPan in #290.
  • Fix the dictionary key order being lost when a treespec built under the global namespace is promoted to an insertion-ordered namespace by @​XuehaiPan in #290.
  • Fix treespec_from_collection() on a leaf reporting an escalated UserWarning as a confusing SystemError, by checking the return value of PyErr_WarnEx() by @​XuehaiPan in #290.
  • Fix treespec_from_collection() keeping the caller's namespace on a leaf or None root, which made otherwise identical treespecs compare unequal by @​XuehaiPan in #290.
  • Fix treespec_is_prefix() and treespec_is_suffix() comparing against a stale subtree when a dictionary node's keys had been reordered by @​XuehaiPan in #290.
  • Fix the tree iterator never reporting or clearing its is_leaf predicate to the garbage collector, leaking any reference cycle that passes through it by @​XuehaiPan in #290.
  • Fix a list shrunk by an is_leaf predicate part way through flattening being read out of bounds on Python versions before 3.13.0a4, now raising IndexError by @​XuehaiPan in #290.
  • Fix a reference cycle passing through a registered custom type not being collectable once the registry no longer holds the registration, by reporting the registration's members to the garbage collector when a treespec's own nodes hold every reference to it; a cycle spanning several treespecs remains uncollectable by @​XuehaiPan in #290.
  • Fix a deeply nested treespec overflowing the native stack and crashing in treespec_paths(), treespec_accessors(), and PyTreeSpec.broadcast_to_common_suffix() instead of raising RecursionError by @​XuehaiPan in #290.
  • Fix DataclassEntry and AttrsEntry resolving an integer entry against every declared field rather than the children the registration emitted, which returned the wrong attribute for a class holding a metadata or non-init field, now read from the record register_node() leaves on the class itself by @​XuehaiPan in #290.
  • Fix optree.dataclasses.register_node() and optree.integrations.attrs.register_node() leaving a class in a half-registered state that could never be registered again: the registry entry and the field marker are now committed together, and a failure of either rolls the other back by @​XuehaiPan in #290.
  • Fix optree.dataclasses.register_node() silently dropping InitVar pseudo-fields, which are neither children nor metadata and cannot round-trip, now rejected with a pointer to the generic API by @​XuehaiPan in #290.
  • Fix tree_broadcast_common() and broadcast_common() applying the caller's is_leaf predicate to an internal sentinel tree, which could raise from the predicate or collapse a filled subtree and under-replicate by @​XuehaiPan in #290.
  • Fix PyTreeEntry equality and hashing comparing the bytecode of __call__() and codify() rather than the methods themselves, so two entry classes that happened to share an implementation compared equal by @​XuehaiPan in #290.
  • Fix PyTreeAccessor overriding __eq__() while inheriting tuple.__ne__(), so comparing one with a plain tuple of equal entries reported False for both == and != by @​XuehaiPan in #290.

... (truncated)

Commits
  • 6b2a48f ver: bump version to 0.20.0
  • 45bba86 deps(python): enable Python 3.15 and Python 3.15t support (#293)
  • 2928b52 feat(setup): migrate to Python_FIND_ABI for CMake's FindPython (#292)
  • 5336257 feat: add built-in frozendict support for Python 3.15+ (#274)
  • 6df80b1 deps(workflows): bump pypa/cibuildwheel from 4.1 to 4.2
  • d34f302 fix(ops,accessors,utils): correct field selection, broadcasting and total ord...
  • 7bc8b3a fix(treespec): correct namespace merging, GC reporting and walker safety
  • 2ba4945 fix(treespec): map struct sequence fields by offset and validate pickled state
  • 879c756 refactor(pytypes): extract WeakKeyCache and make the type caches interpreter-...
  • 4685aa5 fix(registry,traversal): correct lock ordering and re-entrancy
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [optree](https://github.com/metaopt/optree) from 0.19.1 to 0.20.0.
- [Release notes](https://github.com/metaopt/optree/releases)
- [Changelog](https://github.com/metaopt/optree/blob/main/CHANGELOG.md)
- [Commits](metaopt/optree@v0.19.1...v0.20.0)

---
updated-dependencies:
- dependency-name: optree
  dependency-version: 0.20.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file python:uv Pull requests that update python:uv code labels Sep 8, 2026
@tobiasraabe
tobiasraabe added this pull request to the merge queue Sep 19, 2026
Merged via the queue into main with commit bfc707c Sep 19, 2026
23 checks passed
@tobiasraabe
tobiasraabe deleted the dependabot/uv/optree-0.20.0 branch September 19, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python:uv Pull requests that update python:uv code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant