mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-130914: Make graphlib.TopologicalSorter.prepare() idempotent (#131317)
Closes #130914: Make graphlib.TopologicalSorter.prepare() idempotent Relax the rules so that `.prepare()` can be called multiple times, provided that no work has been passed out by `.get_ready()` yet.
This commit is contained in:
parent
f819900245
commit
c1b42db9e4
6 changed files with 44 additions and 7 deletions
|
|
@ -106,6 +106,14 @@
|
|||
function, the graph cannot be modified, and therefore no more nodes can be
|
||||
added using :meth:`~TopologicalSorter.add`.
|
||||
|
||||
A :exc:`ValueError` will be raised if the sort has been started by
|
||||
:meth:`~.static_order` or :meth:`~.get_ready`.
|
||||
|
||||
.. versionchanged:: next
|
||||
|
||||
``prepare()`` can now be called more than once as long as the sort has
|
||||
not started. Previously this raised :exc:`ValueError`.
|
||||
|
||||
.. method:: is_active()
|
||||
|
||||
Returns ``True`` if more progress can be made and ``False`` otherwise.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue