Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1c21814
feat(python): loss codes as Python warnings and MCP losses (#2371)
Mavrick-F Nov 23, 2026
f192214
fix(python): each call raises its own losses; MCP keeps codes on fail…
Mavrick-F Nov 23, 2026
bd1ef51
fix(python): say every loss when one is an error; keep MCP failure co…
Mavrick-F Nov 23, 2026
6a90f86
fix(mcp): fit loss codes in bytes and keep them, with success, in cut…
Mavrick-F Nov 23, 2026
e02f39c
fix(mcp): keep the codes ahead of a cut result at the tightest budgets
Mavrick-F Nov 23, 2026
48cf82e
fix(python): warnings skip only the package's own files; MCP errors s…
Mavrick-F Nov 23, 2026
31613ec
fix(python): loss warnings pickle; MCP losses fit the tightest budget…
Mavrick-F Nov 23, 2026
77c24ae
fix(mcp): a shortened entry for losses not kept keeps its count
Mavrick-F Nov 23, 2026
b8298b0
fix(mcp): a cut failure keeps its error as text, and the tightest bud…
Mavrick-F Nov 23, 2026
92ede85
fix(mcp): size loss forms without serializing the result again; run_t…
Mavrick-F Nov 23, 2026
a765187
fix(python): peer-text calls raise their own losses; a result with it…
Mavrick-F Nov 23, 2026
8a61158
fix(python): a project message from the app opens it through its own …
Mavrick-F Nov 23, 2026
18533a0
fix(python): the widget records the app's project before raising its …
Mavrick-F Nov 23, 2026
d7743ed
fix(assistant): a result that isn't an object keeps its losses; the w…
Mavrick-F Nov 23, 2026
4bd4864
fix(assistant): a successful result cut past its budget is said to be…
Mavrick-F Nov 23, 2026
254eb11
fix(assistant): run's success is cut as a success; a failure cut to i…
Mavrick-F Nov 23, 2026
3272a64
fix(python): the widget raises a failed sync's losses itself, as the …
Mavrick-F Nov 23, 2026
cf19628
fix(assistant): a failure cut to its error says it was cut; the widge…
Mavrick-F Nov 23, 2026
482ef9b
fix(assistant): a result or error cut to its codes always says so; lo…
Mavrick-F Nov 23, 2026
3f92ed5
fix(assistant): a result with its own losses keeps its success and fa…
Mavrick-F Nov 23, 2026
9e6415c
fix(assistant): a cut result with no losses doesn't say a list was tr…
Mavrick-F Nov 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ A result is right, or RustGIS says what it lost or assumed
XLSM shares the XLSX parser; macros are untested.
Exports are checked by `never_silent_roundtrip.rs` _(open)_.
- The remaining loss notices classified by code (the engine carries codes through reader and
tool results today), so `rustgis-cli run --strict` stops at them, and the codes exposed to
Python and MCP ([#2371](https://github.com/opengeos/RustGIS/issues/2371)).
tool results today), so `rustgis-cli run --strict`, Python's warnings and MCP's `losses` see
them ([#2371](https://github.com/opengeos/RustGIS/issues/2371)).
- NTv2 grid shifts named in a file's own definition (a WKT or PROJ string that binds NAD27 to
WGS 84 through a `.gsb` grid), which are said but not applied today (the grids PROJ's
operations use are applied when present and downloaded on request). _Coordinate first_ (needs
Expand Down
138 changes: 132 additions & 6 deletions apps/rustgis-python/python/rustgis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,136 @@
from ._rustgis import RustGISError, __version__
from ._rustgis import load_plugins as _load_plugins

__all__ = ["Layer", "Map", "RustGISError", "Session", "__version__", "load_plugins"]
__all__ = [
"ApproximatedWarning",
"AssumedWarning",
"ChangedWarning",
"DataLossWarning",
"DroppedWarning",
"Layer",
"Map",
"RustGISError",
"Session",
"__version__",
"load_plugins",
]

PathLike = Union[str, "os.PathLike[str]"]


class DataLossWarning(UserWarning):
"""A command lost data: it dropped, changed, approximated or assumed something.

Raised through :mod:`warnings` for each notice that carries a loss code, so
``warnings.filterwarnings("error", category=rustgis.DataLossWarning)`` turns a loss into
an exception. The notice also stays in :meth:`Session.notices`.

Attributes:
code: The loss code, such as ``"dropped.ring"``: never translated, renamed or reused.
The command line guide lists every code with what to do about it.
kind: The code's kind: ``"dropped"``, ``"changed"``, ``"approximated"`` or ``"assumed"``.
"""

def __init__(self, message: str, code: str) -> None:
"""Keeps the notice's text as the message, and its code.

Args:
message: The notice's text.
code: The loss code.
"""
super().__init__(message)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
self.code = code
self.kind = code.split(".", 1)[0]

def __reduce__(self) -> Tuple[Any, ...]:
"""Pickles with the code and what was added to it (notes), so a warning turned into an
error crosses a process boundary, as in a process pool.

Returns:
The class, its arguments and its state.
"""
return (type(self), (self.args[0], self.code), self.__dict__)


class DroppedWarning(DataLossWarning):
"""Something in the input isn't in the result (``dropped.*`` codes)."""


class ChangedWarning(DataLossWarning):
"""A value is in the result but different (``changed.*`` codes)."""


class ApproximatedWarning(DataLossWarning):
"""The result stands in for something it couldn't represent exactly (``approximated.*``)."""


class AssumedWarning(DataLossWarning):
"""The data didn't say, so RustGIS picked (``assumed.*`` codes)."""


_LOSS_WARNINGS = {
"dropped": DroppedWarning,
"changed": ChangedWarning,
"approximated": ApproximatedWarning,
"assumed": AssumedWarning,
}

# Warnings point at the caller's line, not at this package's.
_PACKAGE = (os.path.join(os.path.dirname(__file__), ""),)


def _warn_losses(engine: _Engine, failure: Optional[BaseException] = None) -> None:
"""Raises each loss this thread's calls reported since the last call as a
:class:`DataLossWarning`.

Every loss is warned of, even after a filter turns one into an error: that first one is
raised once all are, and the later ones promoted too are added to it as notes. After a
failed call (``failure``), each promoted warning is added to that exception as a note
instead, and nothing is raised here.

Args:
engine: The session's engine.
failure: The exception the call raised, if it failed.
"""
raised: Optional[Warning] = None
for kind, code, text in engine._take_losses():
category = _LOSS_WARNINGS.get(kind, DataLossWarning)
try:
warnings.warn(category(f"{text} [{code}]", code), skip_file_prefixes=_PACKAGE)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python's default filter for UserWarning subclasses is default: it shows the first warning per location and text. So a loop that calls s.add_data(...) on one line and gets the same loss text each time warns once, and the rest are silent in the warning channel. s.notices() still keeps every occurrence, so nothing is lost, but the warning channel gives no count.

Suggest one of: say so in docs/python.md next to the warning example (warnings.simplefilter("always", rustgis.DataLossWarning) shows each one), or have the class docstring say warnings are per location. Confidence: medium on the behaviour (standard warnings semantics), no current bug.

Category: quality

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended: these are ordinary warnings, and Python's filters decide how often they show. A loop that wants every one uses warnings.simplefilter("always", rustgis.DataLossWarning), and one that wants them as errors uses "error". Every notice is still in s.notices(), whatever the filter does.

except Warning as promoted:
noted = failure if failure is not None else raised
if noted is None:
raised = promoted
else:
noted.add_note(f"{type(promoted).__name__}: {promoted}")
if raised is not None:
raise raised


def _native(engine: _Engine, operation: Any, *args: Any) -> Any:
"""Calls one of the engine's methods, then raises the losses it reported as warnings.

A failed call still raises them, as it can have lost data it couldn't take back, but its own
exception stays the one raised: a warning a filter turns into an error is added to it as a
note.

Args:
engine: The session's engine.
operation: The engine method.
*args: Its arguments.

Returns:
What the method returned.
"""
try:
result = operation(*args)
except BaseException as failure:
_warn_losses(engine, failure)
raise
_warn_losses(engine)
return result


def __getattr__(name: str) -> Any:
"""Imports ``Map`` on first use, so the package works without the notebook widget's
dependencies.
Expand Down Expand Up @@ -847,8 +972,7 @@ def run(self, command: str, params: Optional[Dict[str, Any]] = None, /, **kwargs
encoded = json.dumps(merged, default=_jsonable, allow_nan=False) if merged else ""
except ValueError as e:
raise ValueError(f"{command}: parameters must be finite numbers, text, lists and dicts ({e})") from e
text = self._engine.run(command, encoded)
return json.loads(text)
return json.loads(_native(self._engine, self._engine.run, command, encoded))

def notices(self) -> List[Tuple[str, bool]]:
"""What commands have reported since the last call: warnings about a file, a tool's
Expand All @@ -866,7 +990,7 @@ def _layer_geojson(self, layer: int, selected: bool) -> str:
layer: The layer's id.
selected: Only its selected features.
"""
return self._engine.layer_geojson(layer, selected)
return _native(self._engine, self._engine.layer_geojson, layer, selected)

def _root(self) -> "Session":
"""The session that holds the project: this one."""
Expand All @@ -888,7 +1012,7 @@ def project_json(self) -> str:
Returns:
The JSON text; ``run("project.openText", text=...)`` opens it.
"""
return self._engine.project_json()
return _native(self._engine, self._engine.project_json)

# Maps ----------------------------------------------------------------------------------

Expand All @@ -912,7 +1036,9 @@ def to_png(
The PNG bytes.
"""
png = bytes(
self._engine.render_png(
_native(
self._engine,
self._engine.render_png,
None if width is None else float(width),
None if height is None else float(height),
None if dpi is None else float(dpi),
Expand Down
35 changes: 28 additions & 7 deletions apps/rustgis-python/python/rustgis/_embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
from urllib.parse import quote

from . import PathLike, RustGISError, Session, _Api
from . import PathLike, RustGISError, Session, _Api, _warn_losses

#: The web app the widgets show; ``RUSTGIS_WEB_URL`` points them at another build (a local
#: ``trunk serve``, a self-hosted copy).
Expand Down Expand Up @@ -204,8 +204,9 @@ def to_png(

def _push(self) -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The widget's loss branches were rewritten in this PR. _push and _from_app now raise promoted warnings, record the project before raising, and drain losses on every exception path. Earlier review rounds found three bugs in them: a NameError, an ordering problem, and a swallowed exception. None of them is pinned by a test here. tests/test_widget.py has no DataLossWarning or error-filter assertions.

Suggested test, in the widget test module: a project that loses something on open, pushed through _from_app under filterwarnings("error", category=rustgis.DataLossWarning), should raise, and _project should still hold the app's text. A clean project should raise nothing. The same goes for a _push that hits a loss.

Category: quality

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 482ef9b: a widget test opens the app's project through an engine that reports a lost ring. Under an error filter, the DroppedWarning is raised after _project holds the app's text. A project that can't be read raises its losses rather than its error, and the default filter warns.

"""Sends the session's project to the app, when it changed."""
engine = self._session._engine
try:
text, keys, notices = self._session._engine._peer_text()
text, keys, notices = engine._peer_text()
# A new loss may leave the public project text unchanged.
if text != self._project or notices != self._sent_notices:
self._hold([(notice, False) for notice in notices])
Expand All @@ -215,10 +216,21 @@ def _push(self) -> None:
self._sent_keys = keys
except RustGISError as e:
self._hold([(f"couldn't show the project in the app: {e}", True)])
# The error is held, not raised: its losses are raised themselves.
_warn_losses(engine)
return
if text != self._project:
self._project = text
self._send_project(text)
except BaseException as failure:
_warn_losses(engine, failure)
raise
try:
if text != self._project:
self._project = text
self._send_project(text)
except BaseException as failure:
_warn_losses(engine, failure)
raise
# Raised once the app has the project, which a warning filter can turn into an error.
_warn_losses(engine)

def _hold(self, notices: List[Tuple[str, bool]]) -> None:
"""Keeps notices for :meth:`notices`.
Expand All @@ -245,16 +257,25 @@ def _from_app(self, content: Any) -> None:
return
# Peer input is an import: keep its containment notices and invalidate old trust.
self._hold(self._session.notices())
engine = self._session._engine
try:
self._session._engine._open_peer_text(text)
engine._open_peer_text(text)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reply on the earlier thread about _peer_text and _open_peer_text says both now run through _native. That is true of _peer_text (line 209), but this line calls engine._open_peer_text(text) directly, so the reply doesn't match the code. This is new evidence, so I'm raising the mechanism again.

Today the losses are drained on the success path (line 262) and on the RustGISError path (line 254). If _open_peer_text raises anything else, nothing drains them. They stay pending for this thread and the next _native call on it raises them as warnings for a call that didn't cause them. The trigger is narrow (an exception other than RustGISError from _open_peer_text), so the impact is low.

Routing this line through _native is not a drop-in fix. It would raise promoted warnings before self._project = text is recorded, which is the state 18533a0 fixed. A fix that keeps that order needs the drain on every exception path, for example a BaseException handler that calls _warn_losses(engine, failure) and re-raises. Confidence: medium on the mechanism, low on impact.

Category: bug

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d7743ed: _from_app now has a BaseException handler that drains the losses with the failure and re-raises. The project is still recorded before the success path raises its warnings.

except RustGISError as e:
self._hold([(f"the app's project couldn't be read: {e}", True)])
# The error is held, not raised: its losses are raised themselves.
_warn_losses(engine)
return
except BaseException as failure:
# Whatever else stopped it, its losses are raised with it, not by a later call.
_warn_losses(engine, failure)
raise
finally:
self._hold(self._session.notices())
# The app's own text, not the session's re-serialised copy: the app then sees its
# project and doesn't open it again.
# project and doesn't open it again. Recorded before its losses are raised, which a
# warning filter can turn into an error.
self._project = text
_warn_losses(engine)
elif kind == "result" and content.get("ok") is False:
self._hold([(str(content.get("error", "the command failed")), True)])

Expand Down
1 change: 1 addition & 0 deletions apps/rustgis-python/python/rustgis/_rustgis.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ class Engine:
def layer_geojson(self, layer: Union[int, str], selected: bool = False) -> str: ...
def project_json(self) -> str: ...
def take_notices(self) -> List[Tuple[str, bool]]: ...
def _take_losses(self) -> List[Tuple[str, str, str]]: ...

def load_plugins() -> List[str]: ...
64 changes: 62 additions & 2 deletions apps/rustgis-python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use pyo3::create_exception;
use pyo3::exceptions::{PyException, PyValueError};
use pyo3::prelude::*;
use pyo3::types::PyBytes;
use rustgis_engine::data::loss::LossCode;
use rustgis_engine::{Project, Session};
use serde_json::Value;
use std::io::Write;
Expand Down Expand Up @@ -84,13 +85,20 @@ struct Engine {
/// What the session's store reported (the first failure of the keychain, a preferences file
/// that couldn't be read), waiting to be logged by the call that is running or the next one.
diagnostics: Arc<Mutex<Vec<String>>>,
/// Classified losses not yet raised as warnings, and where collecting them last stopped (the
/// notice mark and the session's loss counts). Only locked inside the session's lock.
losses: Mutex<Losses>,
}

impl Engine {
/// Runs `operation` on the session, then sets aside the losses it reported for the thread that
/// called it, under the same lock, so a call on another thread can't take them.
fn with_session<T: Send>(&self, py: Python<'_>, operation: impl FnOnce(&mut Session) -> T + Send) -> T {
with_native(py, || {
let mut session = self.session.lock().unwrap_or_else(|poisoned| poisoned.into_inner());
operation(&mut session)
let result = operation(&mut session);
self.losses.lock().unwrap_or_else(|poisoned| poisoned.into_inner()).collect(&session);
result
})
}

Expand All @@ -104,8 +112,43 @@ impl Engine {
}
}

/// See [`Engine::losses`].
struct Losses {
/// `(kind, code, text)` for the thread whose call reported it.
pending: Vec<(std::thread::ThreadId, (String, String, String))>,
mark: u64,
given: Vec<(LossCode, u64)>,
}

impl Losses {
/// Sets aside the losses `session` gave since the last call, for the calling thread, while
/// their notices are still in its queue (after every call, so before `take_notices` drains
/// it). One the queue no longer keeps (past its last 200) is set aside as one entry per code
/// that says how many.
fn collect(&mut self, session: &Session) {
let thread = std::thread::current().id();
let kept: Vec<(LossCode, String)> =
session.notices_since(self.mark).iter().filter_map(|n| n.loss().map(|code| (code, n.text.clone()))).collect();
for &(code, given) in session.losses_given() {
let was = self.given.iter().find(|(c, _)| *c == code).map_or(0, |(_, n)| *n);
let held = kept.iter().filter(|(c, _)| *c == code).count() as u64;
let lost = given.saturating_sub(was).saturating_sub(held);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This delta can report losses that never reached the user. losses_given is only decremented on rollback for losses still in the notice queue (crates/engine/src/lib.rs, around lines 2479-2492: new is capped at notices.len() and notices_given is reduced by new - kept). A failed command that produced more than 200 notices, with a loss among the evicted ones, is rolled back, but its evicted losses stay counted. The delta here (and the same logic in losses_since) then reports them as "N further … notice(s) were not kept" for a command whose changes were undone. Possible fix: snapshot losses_given when the command starts, and restore the per-code counts to the snapshot plus the withdrawn queued losses on rollback. I haven't reproduced this, and the fix belongs in the engine, outside this diff; confidence is medium.

Category: bug

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This follows the engine rule that #2736 set for Session::losses_given: a failed command's losses are taken back with its changes, except one whose notice the queue had already let go. The engine no longer knows whether such a notice described a committed write, which outlives the rollback. Counting it errs towards reporting a loss that may not have happened, rather than missing one that did. It needs a failed command that gave more than 200 notices, and the warning says the notices were not kept. Changing the rule belongs in the engine, so I have left it as documented there.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "not kept" delta (given - was - held, then the "N further … notice(s) were not kept" text) is computed again in losses_since (crates/assistant/src/tools.rs, around line 915), with the same arithmetic. Both feed the same contract (a loss the queue no longer keeps is counted once per code), so a later change to one side, such as how a rollback withdraws counts, would silently make the Python warnings and the MCP losses disagree. Suggest one helper on Session (for example Session::losses_not_kept(since_mark, given_before) -> Vec<(LossCode, u64)>) that both call, so the rule lives in the engine next to losses_given. Confidence: high that the logic is duplicated; no current bug observed, since both copies agree today.

Category: quality

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both copies agree today. Moving the rule into one Session helper next to losses_given is left for the release quality pass.

if lost > 0 {
let spec = code.spec();
let text = format!("{lost} further {} notice(s) were not kept", spec.id);
self.pending.push((thread, (spec.kind.id().into(), spec.id.into(), text)));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Losses set aside here stay in pending for this thread until a _native call on the same thread drains them. _peer_text and _open_peer_text (called from python/rustgis/_embed.py around lines 208 and 249) don't go through _native, so any coded loss they produce waits there. The next Session.run on that thread then raises it as a warning for a call that didn't cause it, and nothing caps pending for threads that never call _native again. I confirmed the mechanism but not that these two paths emit coded losses today; they reach notify_loss/notify_counted only indirectly. Suggest draining in those wrappers too (or a _take_losses call after each), or dropping the pending entries for them, and a test that a peer open with a loss doesn't surface on the next run.

Confidence: medium on the mechanism, low on current trigger.

Category: bug

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a765187: _embed.py runs _peer_text and _open_peer_text through _native, so their losses are raised by those calls, not a later one.

}
}
self.pending.extend(kept.into_iter().map(|(code, text)| (thread, (code.spec().kind.id().into(), code.spec().id.into(), text))));
self.mark = session.notice_mark();
self.given = session.losses_given().to_vec();
}
}

#[pymethods]
impl Engine {
/// An empty session; `use_saved_secrets` reads the desktop app's saved connections, and
/// asks the system keychain for a secret only when a command needs one.
#[new]
#[pyo3(signature = (use_saved_secrets=false))]
fn new(py: Python<'_>, use_saved_secrets: bool) -> Self {
Expand All @@ -121,7 +164,8 @@ impl Engine {
}
session
});
let engine = Engine { session: Mutex::new(session), diagnostics };
let losses = Losses { pending: Vec::new(), mark: session.notice_mark(), given: session.losses_given().to_vec() };
let engine = Engine { session: Mutex::new(session), diagnostics, losses: Mutex::new(losses) };
engine.flush(py);
engine
}
Expand Down Expand Up @@ -270,6 +314,22 @@ impl Engine {
result.map_err(RustGISError::new_err)
}

/// The classified losses this thread's calls reported since it last asked, as
/// `(kind, code, text)`, oldest first, which the package raises as warnings; `take_notices`
/// still returns them too.
fn _take_losses(&self, py: Python<'_>) -> Vec<(String, String, String)> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_take_losses runs after every _native call, and it takes with_native, which locks the process-wide NATIVE_OPERATIONS static, then the session lock. Before this PR a call took that global lock once. Now it takes it again after its own work is done, so a call can return only after another session's running native operation finishes. With several Python threads, one long render or tool on thread B delays thread A's return, even when A has no losses.

The session lock isn't needed here either. This thread's losses were already collected under the lock by its own call, which has returned. The only lock this method needs is self.losses, which with_session already takes after the session lock, so the order stays intact.

Suggested direction: drop with_native and the session lock from _take_losses, lock only self.losses, and keep the thread partition. The comment about never setting losses aside while the session runs would then need rewording.

Confidence: medium-high on the mechanism, impact limited to multi-threaded use.

Category: performance

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 482ef9b. _take_losses takes only the losses' own lock, outside the GIL. It no longer takes the native-operations lock or the session's, so a call returns without waiting for another session's work.

let thread = std::thread::current().id();
let losses = &self.losses;
// This thread's own call set them aside under the session's lock and has returned, so
// only their own lock is needed: taking them doesn't wait for another session's work.
py.detach(|| {
let mut losses = losses.lock().unwrap_or_else(|poisoned| poisoned.into_inner());
let (mine, others) = std::mem::take(&mut losses.pending).into_iter().partition(|(t, _)| *t == thread);
losses.pending = others;
mine.into_iter().map(|(_, loss)| loss).collect::<Vec<_>>()
})
}

/// The notices commands have given since the last call (a file's warnings, a tool's
/// summary): `(text, is_error)` pairs, oldest first.
fn take_notices(&self, py: Python<'_>) -> Vec<(String, bool)> {
Expand Down
Loading
Loading