Inline `send_yield` body to drop its deprecation
`experimental._pubsub`'s `fan_out_to_ctxs()` pushed each packet
via the now-deprecated `Context.send_yield()`, tripping its own
`DeprecationWarning` on every published msg.
Inline that method's exact body —
`await ctx.chan.send(Yield(cid=ctx.cid, pld=payload))` — so the
wire msg stays byte-identical (still a `Yield`) yet no warning
fires. The "proper" fix (swap to `MsgStream.send()` via
`Context.open_stream()`) needs BOTH sides migrated: the
subscriber still uses the legacy `Portal.open_stream_from()`
which never calls `.started()`, so a publisher-side
`open_stream()` raises a `RuntimeError` ("`started()` must be
called before opening a stream") — verified. Left as the
module's standing rework TODO.
(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
wkt/rm_test_warnings
parent
d55c971644
commit
bc91a1bdfa
|
|
@ -38,6 +38,7 @@ import wrapt
|
||||||
|
|
||||||
from ..log import get_logger
|
from ..log import get_logger
|
||||||
from .._context import Context
|
from .._context import Context
|
||||||
|
from ..msg import Yield
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['pub']
|
__all__ = ['pub']
|
||||||
|
|
@ -88,7 +89,18 @@ async def fan_out_to_ctxs(
|
||||||
if ctx_payloads:
|
if ctx_payloads:
|
||||||
for ctx, payload in ctx_payloads:
|
for ctx, payload in ctx_payloads:
|
||||||
try:
|
try:
|
||||||
await ctx.send_yield(payload)
|
# NOTE: inline the (now-deprecated)
|
||||||
|
# `Context.send_yield()` body to drop its
|
||||||
|
# `DeprecationWarning` without a behaviour change.
|
||||||
|
# The "proper" fix is migrating BOTH sides to
|
||||||
|
# `open_context()`/`open_stream()`, but the
|
||||||
|
# subscriber still uses the legacy
|
||||||
|
# `Portal.open_stream_from()` (no `started()`
|
||||||
|
# handshake) so `Context.open_stream()` can't be
|
||||||
|
# used here yet — see this module's rework TODO.
|
||||||
|
await ctx.chan.send(
|
||||||
|
Yield(cid=ctx.cid, pld=payload)
|
||||||
|
)
|
||||||
except (
|
except (
|
||||||
# That's right, anything you can think of...
|
# That's right, anything you can think of...
|
||||||
trio.ClosedResourceError, ConnectionResetError,
|
trio.ClosedResourceError, ConnectionResetError,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue