Selected changesmerged Nov 12, 2026 – Nov 18, 2026
fix: Keep unlocked writes streaming while a busy callback holds the lockPython · 111 + / 25 −
Introduces 4 new declarations in panel/io/document.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
panel/io/document.py ↗ · 2 files
@@ -483,32 +521,39 @@ def _split_unknown_to_client( defines, and changes to a property the unwritten changes also set, whose older value would otherwise overwrite the newer one. """+ # Only membership is tested below, so the key sets the other contexts+ # add to are not copied, keeping each flush independent of how many+ # changes are already waiting. with _WRITE_LOCK: records = list(_UNWRITTEN.get(doc, []))- deferred = list(_DEFERRED_EVENTS.get(doc, []))- pending = session._pending_writes or []- if not (records or deferred or pending or _is_locked_elsewhere(session)):+ deferred = _DEFERRED_KEYS.get(doc, set())+ pending = _pending_keys(session)+ waiting = doc in _DEFERRED_EVENTS+ if not (records or waiting or pending or _is_locked_elsewhere(session)): return events, []- unsent = {model.id for model in _unsent_models(doc)}- unwritten = set().union(*(record.models for record in records))- changes = set().union(*(record.changes for record in records))- changes |= {key for event in deferred if (key := _change_key(event))}- changes |= {key for patch in list(pending) if (key := _change_key(patch.event))}+ unsent = getattr(doc.models, '_new_models', None) or set()+ held_keys: set[tuple[str, str]] = set() immediate, held = [], [] for event in events: model = _event_target(event)+ key = _change_key(event) if isinstance(event, ModelChangedEvent): value = event.new elif isinstance(event, MessageSentEvent): value = event.msg_data else: value = None
ENH: Series.interval accessor (GH#16401)Python · 113 + / 0 −
Introduces 6 new declarations in pandas/core/arrays/interval.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
pandas/core/arrays/interval.py ↗ · 7 files
@@ -2003,3 +2013,102 @@ def _maybe_convert_platform_interval(values) -> ArrayLike: if values.dtype.kind in "iu" and values.dtype != np.int64: values = values.astype(np.int64) return values+++# ---------------------------------------------------------------------+# The Series.interval accessor+++@delegate_names(+ delegate=IntervalArray,+ accessors=["left", "right", "mid", "length", "is_empty", "closed"],+ typ="property",+)+@delegate_names(+ delegate=IntervalArray,+ accessors=["overlaps", "contains", "set_closed"],+ typ="method",+)+class IntervalAccessor(PandasDelegate, PandasObject, NoNewAttributesMixin):+ """+ Accessor object for interval properties of the Series values.++ Provides the endpoints, midpoints and lengths of the intervals, and+ elementwise checks for containment and overlap, each returned as a+ Series aligned with the original. A categorical Series with interval+ categories, such as the result of :func:`cut`, is also supported.++ Parameters+ ----------+ data : Series+ The Series with interval or interval-categorical dtype to which the+ accessor is attached.
Turbopack: detect top-level `this` as CommonJS exportsRust · 101 + / 4 −
Introduces 10 new declarations in turbopack/crates/turbopack-ecmascript/src/references/exports.rs.
Adds new framework internals rather than adjusting what was there. Tests changed with it, with code of their own.
turbopack/crates/turbopack-ecmascript/src/references/exports.rs ↗ · 12 files
@@ -378,3 +418,60 @@ pub fn is_turbopack_helper_import(import: &ImportDecl) -> bool { pub fn is_swc_helper_import(import: &ImportDecl) -> bool { import.src.value.starts_with("@swc/helpers/") }++#[cfg(test)]+mod tests {+ use swc_core::{+ common::{FileName, SourceMap, sync::Lrc},+ ecma::{+ ast::EsVersion,+ parser::{Syntax, parse_file_as_program},+ },+ };++ use super::{DetectedDynamicExportType, detect_dynamic_export};++ fn is_cjs(code: &str, top_level_this_is_exports: bool) -> bool {+ let cm = Lrc::new(SourceMap::default());+ let fm = cm.new_source_file(Lrc::new(FileName::Anon), code.to_string());+ let program = parse_file_as_program(+ &fm,+ Syntax::Es(Default::default()),+ EsVersion::latest(),+ None,+ &mut vec![],+ )+ .expect("Failed to parse");+ matches!(+ detect_dynamic_export(&program, top_level_this_is_exports),+ DetectedDynamicExportType::CommonJs+ )+ }+
fix: Order unlocked writes after the changes of the document lock holderPython · 259 + / 13 −
Introduces 21 new declarations in panel/io/document.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
panel/io/document.py ↗ · 3 files
@@ -354,9 +370,185 @@ def _track_task(doc: Document, task: asyncio.Task) -> None: _write_tasks.setdefault(doc, []).append(task) task.add_done_callback(partial(_cleanup_task, doc)) +@contextmanager+def _owning_document_lock(session: ServerSession) -> Iterator[None]:+ """+ Marks the calling context as holding the session's document lock and+ first writes the events other contexts held back while it was taken+ by someone else, so they precede the changes made under this lock.+ """+ with state._own_document_lock(session):+ if session.document in _DEFERRED_EVENTS:+ try:+ _dispatch_deferred_events(session.document)+ except Exception:+ logger.exception('Failed to dispatch deferred events')+ yield++def _run_owning_document_lock(session: ServerSession, func: Callable[..., t.Any], *args, **kwargs) -> t.Any:+ with _owning_document_lock(session):+ result = func(*args, **kwargs)+ if inspect.isawaitable(result):+ awaiting = _await_owning_document_lock(session, result)+ if inspect.iscoroutine(result):+ # Bokeh closes the callback's coroutine if it is cancelled+ # before awaiting it, which only reaches ours.+ weakref.finalize(awaiting, result.close)+ return awaiting+ return result++async def _await_owning_document_lock(session: ServerSession, awaitable: t.Awaitable) -> t.Any:+ with state._own_document_lock(session):+ return await awaitable
fix: Do not echo frontend changes released by a hold back to their clientPython · 48 + / 6 −
Introduces 4 new declarations in panel/io/server.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
panel/io/server.py ↗ · 3 files
@@ -796,17 +796,58 @@ def wrapper(self, *args, **kwargs): wrapper._panel_tracks_lock = True # type: ignore[attr-defined] return wrapper ++def _tag_held_patch_events(func):+ """+ Records the connection a patch was received on on the frontend+ changes it leaves held on the Document. Bokeh only skips the+ originating connection while the patch is being applied, so when a+ hold dispatches the change later it would otherwise be echoed back+ to the client and revert anything changed there since.+ """+ @wraps(func)+ async def wrapper(self, message, connection):+ try:+ return await func(self, message, connection)+ finally:+ for event in list(self.document.callbacks._held_events):+ if getattr(event, 'setter', None) is self and getattr(event, '_panel_patch_connection', None) is None:+ event._panel_patch_connection = connection+ return wrapper+++def _skip_patch_connection(document_patched):+ @wraps(document_patched)+ def wrapper(self, event):+ connection = getattr(event, '_panel_patch_connection', None)+ if connection is None:+ return document_patched(self, event)+ current = self._current_patch_connection+ self._current_patch_connection = connection+ try:+ return document_patched(self, event)
Exit cleanly when using launcherPython · 100 + / 51 −
Introduces 7 new declarations in src/accelerate/commands/launch.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
src/accelerate/commands/launch.py ↗ · 3 files
@@ -981,19 +986,65 @@ def launch_command_parser(subparsers=None): return parser -def simple_launcher(args):- cmd, current_env = prepare_simple_launcher_cmd_env(args)+def _terminate_process_tree(process):+ processes = [process]+ # Capture descendants before stopping their parent, including workers in separate sessions.+ with suppress(psutil.NoSuchProcess):+ processes.extend(process.children(recursive=True))+ alive = processes+ try:+ for child in processes:+ with suppress(psutil.NoSuchProcess):+ child.terminate()+ _, alive = psutil.wait_procs(processes, timeout=5)+ except (KeyboardInterrupt, SystemExit):+ pass+ finally:+ for child in alive:+ with suppress(psutil.NoSuchProcess):+ child.kill()+ psutil.wait_procs(alive, timeout=5)+ process.wait()+ +def _run_subprocess(cmd, current_env, quiet): # Tee the child's stderr: write it through as it arrives so output stays live, and keep the tail for the error.- process = subprocess.Popen(cmd, env=current_env, stderr=subprocess.PIPE)+ process = psutil.Popen(cmd, env=current_env, stderr=subprocess.PIPE) tail = deque(maxlen=CHILD_STDERR_TAIL_CHUNKS)- while chunk := process.stderr.read1(CHILD_STDERR_CHUNK_SIZE):- sys.stderr.buffer.write(chunk)
[Chat Parsing] Add `python-call-list` content parserPython · 153 + / 3 −
Introduces 13 new declarations in src/transformers/utils/chat_parsing/content_parsers.py.
Adds new language design rather than adjusting what was there. Tests changed with it, with code of their own.
src/transformers/utils/chat_parsing/content_parsers.py ↗ · 5 files
@@ -137,6 +139,153 @@ def _kv_lines(text: str, args: dict) -> dict: return out +_CALL_LIST_WHITESPACE = re.compile(r"[ \t\n\r]*")+_CALL_LIST_NAME = re.compile(r"[A-Za-z_][A-Za-z0-9_]*(?:[-.][A-Za-z0-9_]+)*")+_CALL_LIST_NUMBER = re.compile(r"-?(?:0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?")+_CALL_LIST_STRING = re.compile(r"""'((?:[^'\\\n\r]|\\.)*)'|"((?:[^"\\\n\r]|\\.)*)\"""", flags=re.DOTALL)+_CALL_LIST_UNICODE_ESCAPE = re.compile(r"u([0-9a-fA-F]{4})")+_CALL_LIST_SURROGATE = re.compile(r"[\ud800-\udfff]")+_CALL_LIST_LOW_SURROGATE = re.compile(r"\\u([dD][c-fC-F][0-9a-fA-F]{2})")+_CALL_LIST_ESCAPES = {"\\": "\\", "'": "'", '"': '"', "/": "/", "b": "\b", "f": "\f", "n": "\n", "r": "\r", "t": "\t"}+_CALL_LIST_CONSTANTS = {"True": True, "true": True, "False": False, "false": False, "None": None, "null": None}+_CALL_LIST_MAX_INTEGER = 2**53 - 1+_CALL_LIST_MAX_DEPTH = 100+++def _python_call_list(text: str, args: dict) -> list[dict]:+ """Parse a list of keyword-argument calls, e.g. `[get_weather(city="Paris")]`, into+ `[{"name": ..., "arguments": {...}}]`. The grammar is specified in `docs/source/en/chat_response_parsing.md`+ and is deliberately strict, so that implementations in other languages can match it exactly."""+ position = 0++ def fail(message: str) -> NoReturn:+ raise ValueError(f"python-call-list: {message} at position {position}.\nContent: {text!r}")++ def skip_whitespace() -> None:+ nonlocal position+ position = _CALL_LIST_WHITESPACE.match(text, position).end()++ def at(char: str) -> bool:+ skip_whitespace()+ return text.startswith(char, position)+
hexagon: pass small aggregates on the stack when registers run outRust · 70 + / 19 −
Introduces 3 new declarations in compiler/rustc_target/src/callconv/hexagon.rs.
Adds new language design rather than adjusting what was there. Tests changed with it, with code of their own.
compiler/rustc_target/src/callconv/hexagon.rs ↗ · 3 files
@@ -41,29 +68,50 @@ where } if arg.layout.pass_indirectly_in_non_rustic_abis(cx) { arg.make_indirect();+ // The pointer to the indirectly passed value takes up a register.+ adjust_regs_left(Size::from_bytes(4), regs_left); return; } + let size = arg.layout.size;+ if !arg.layout.is_aggregate() {+ if size.bytes() <= 8 {+ adjust_regs_left(size, regs_left);+ } arg.extend_integer_width_to(32); return; } - // Per the Hexagon ABI:- // - Aggregates up to 32 bits are passed in a single register- // - Aggregates 33-64 bits are passed in a register pair- // - Aggregates > 64 bits are passed on the stack- let size = arg.layout.size;- let bits = size.bits();- if bits <= 32 {- arg.cast_to(Uniform::new(Reg::i32(), size));- } else if bits <= 64 {- arg.cast_to(Uniform::new(Reg::i64(), size));+ if size.bytes() > 8 {+ arg.pass_by_stack_offset(None);+ return;+ }+
Run the dev Cache Components validation in an OTel trace of its ownTypeScript · 190 + / 147 −
Introduces 3 new declarations in packages/next/src/server/app-render/app-render.tsx.
Adds new framework internals rather than adjusting what was there. Tests changed with it, with code of their own.
packages/next/src/server/app-render/app-render.tsx ↗ · 4 files
@@ -4848,167 +4851,173 @@ function runDevValidationInBackground( return } - return runInstantInsightsWithTracing(ctx, async (runSpan) => {- // Read whether the streamed render errored only now that it has fully- // settled.- const devRenderDidError = getDevRenderDidError()-- const [instantInputs, staticInputs] = await runSpan(- AppRenderSpan.instantInsightsPrepareValidation,- 'Prepare validation inputs',- async () => {- const lazyInputs = await prepareValidationInputs(- prefetchMode,- navigationKind,- result,- requestStore,- validationDebugChannel,- ctx,- prerenderResumeDataCache,- createRequestStore,- getPayload,- onError,- validationAbortSignal- )+ return runInDevValidationTrace(ctx, renderSpanContext, () =>+ runInstantInsightsWithTracing(ctx, async (runSpan) => {+ // Read whether the streamed render errored only now that it has fully+ // settled.+ const devRenderDidError = getDevRenderDidError()++ const [instantInputs, staticInputs] = await runSpan(+ AppRenderSpan.instantInsightsPrepareValidation,
Resync watchers as they catch upGo · 89 + / 17 −
Introduces 5 new declarations in staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go.
Adds new systems design rather than adjusting what was there. Tests changed with it, with code of their own.
staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go ↗ · 3 files
@@ -620,21 +654,32 @@ func (c *Cacher) resyncWatchers() { c.stopWatcherLocked(watcher, true) continue }- if stalledWatchers.empty() {- stalledWatchers = indexedWatchers{- scopeWatchers: make(map[namespacedName]watchersMap),- indexWatchers: make(map[string]watchersMap),- }- minResourceVersion = watcher.dispatchedResourceVersion- } else if watcher.dispatchedResourceVersion < minResourceVersion {- minResourceVersion = watcher.dispatchedResourceVersion- }- stalledWatchers.addWatcher(watcher)+ stalled = append(stalled, watcher) }+ return stalled+} - if !stalledWatchers.empty() {- c.resyncStalledWatchersLocked(&stalledWatchers, minResourceVersion)+func rsyncMinResourceVersion(candidates []*cacheWatcher, cursorRV uint64) uint64 {+ if minRV, ok := minDispatchedResourceVersion(candidates, cursorRV); ok {+ return minRV+ }+ minRV, _ := minDispatchedResourceVersion(candidates, 0)+ return minRV+}++func minDispatchedResourceVersion(watchers []*cacheWatcher, floorRV uint64) (uint64, bool) {+ var minRV uint64+ found := false+ for _, watcher := range watchers {+ if watcher.dispatchedResourceVersion < floorRV {
Do not suggest `as_deref` for a slice pattern on `Err`Rust · 84 + / 5 −
Introduces 6 new declarations in compiler/rustc_hir_typeck/src/pat.rs.
Adds new language design rather than adjusting what was there. Tests changed with it, with code of their own.
compiler/rustc_hir_typeck/src/pat.rs ↗ · 3 files
@@ -3309,6 +3317,77 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }) } + fn slice_pattern_is_direct_payload(+ &self,+ top_pat_id: HirId,+ slice_id: HirId,+ is_option: bool,+ ) -> bool {+ let Some(ctor_id) = self.next_significant_pat(slice_id, top_pat_id) else {+ return false;+ };+ self.hir_pat_is_some_or_ok(ctor_id, is_option)+ && self.only_transparent_pats_until(ctor_id, top_pat_id)+ }++ /// First ancestor pattern that is not `&`, a guard, a binding, or an or-pattern.+ /// `None` when that walk reaches `top_pat_id` or leaves the pattern without one.+ fn next_significant_pat(&self, start: HirId, top_pat_id: HirId) -> Option<HirId> {+ for (id, node) in self.tcx.hir_parent_iter(start) {+ let hir::Node::Pat(pat) = node else { return None };+ if self.pat_is_transparent(pat) {+ if id == top_pat_id {+ return None;+ }+ continue;+ }+ return Some(id);+ }+ None+ }++ /// `start` is `top_pat_id`, or every pattern from `start` up through `top_pat_id`
Expert-parallel implementations for `ep_dispatch_experts`: all-reduce at inference, all-to-all in trainingPython · 233 + / 128 −
Introduces 20 new declarations in src/transformers/distributed/expert_parallel.py.
Adds new runtime rather than adjusting what was there. Tests changed with it, with code of their own.
src/transformers/distributed/expert_parallel.py ↗ · 7 files
@@ -247,109 +300,134 @@ def _dispatch_tokens( expert_ids = top_k_index.reshape(-1) order = torch.argsort(expert_ids) send_tokens = hidden_states[order // num_top_k]- send_counts = torch.zeros(num_local_experts * ep_size, dtype=torch.long, device=hidden_states.device)- send_counts = send_counts.scatter_add_(0, expert_ids, torch.ones_like(expert_ids)).view(- ep_size, num_local_experts- )+ send_counts = torch.zeros(self.num_local_experts * ep_size, dtype=torch.long, device=hidden_states.device)+ send_counts = send_counts.scatter_add_(0, expert_ids, torch.ones_like(expert_ids))+ send_counts = send_counts.view(ep_size, self.num_local_experts) recv_counts = torch.empty_like(send_counts)- torch.distributed.all_to_all_single(recv_counts, send_counts, group=ep_group)+ all_to_all_single(recv_counts, send_counts, group=ep_group) send_sizes, recv_sizes = torch.stack([send_counts.sum(dim=1), recv_counts.sum(dim=1)]).tolist() recv_tokens = all_to_all_single_autograd(send_tokens, recv_sizes, send_sizes, ep_group)- recv_expert_ids = torch.arange(num_local_experts, device=hidden_states.device).repeat(ep_size)+ # hand the experts the received rows, not the all-to-all's pending result (whose pointer is null until+ # waited on): https://github.com/huggingface/transformers/pull/49421+ recv_tokens = _WaitTensor.apply(recv_tokens)+ recv_expert_ids = torch.arange(self.num_local_experts, device=hidden_states.device).repeat(ep_size) recv_expert_ids = recv_expert_ids.repeat_interleave(recv_counts.reshape(-1), output_size=sum(recv_sizes))- return recv_tokens, recv_expert_ids, order, send_sizes, recv_sizes-- def _run_local_experts(- self,- experts_forward: Callable,- tokens: torch.Tensor,- expert_ids: torch.Tensor,- ) -> torch.Tensor:- """Run local experts with top-1 routing and unit weights; apply routing weights after combine."""- num_tokens = tokens.shape[0]- if num_tokens == 0:- # Keep the empty tokens connected to backward so the reverse all-to-all and FSDP reduction still run.