Selected changesmerged 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
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+ )+ }+
[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)+
model:add Zaya1 8B (Zyphra)C++ · 449 + / 3 −
Introduces 22 new declarations in src/models/zaya1.cpp.
Adds new runtime rather than adjusting what was there. Tests changed with it, with code of their own.
src/models/zaya1.cpp ↗ · 19 files
@@ -0,0 +1,340 @@+#include "models.h"+#include "llama-memory-recurrent.h"++void llama_model_zaya1::load_arch_hparams(llama_model_loader & ml) {+ ml.get_key(LLM_KV_ATTENTION_LAYERNORM_RMS_EPS, hparams.f_norm_rms_eps);+ ml.get_key(LLM_KV_SSM_CONV_KERNEL, hparams.ssm_d_conv);+ ml.get_key(LLM_KV_ROUTER_HIDDEN_SIZE, hparams.n_router_hidden);+ ml.get_key_or_arr(LLM_KV_EXPERT_FEED_FORWARD_LENGTH, hparams.n_ff_exp_arr, hparams.n_layer_all);++ if (hparams.ssm_d_conv != 2) {+ throw std::runtime_error("zaya1: only ssm.conv_kernel == 2 is supported");+ }+ // the two kv heads are v_cur and v_del, and the router picks one expert+ for (uint32_t il = 0; il < hparams.n_layer(); ++il) {+ if (hparams.n_head_kv(il) != 2 || hparams.n_embd_head_v(il) != hparams.n_embd_head_k(il) || hparams.n_expert_used(il) != 1) {+ throw std::runtime_error("zaya1: only 2 kv heads of equal k/v size and 1 used expert are supported");+ }+ }++ hparams.n_cca_qk = (hparams.n_head() + hparams.n_head_kv()) * hparams.n_embd_head_k();++ std::fill(hparams.is_recr_impl.begin(), hparams.is_recr_impl.end(), true);++ switch (hparams.n_layer()) {+ case 40: type = LLM_TYPE_8B_A1B; break;+ default: type = LLM_TYPE_UNKNOWN;+ }+}++void llama_model_zaya1::load_arch_tensors(llama_model_loader &) {+ LLAMA_LOAD_LOCALS;++ const int64_t n_embd_head = n_embd_head_k;
BUG: ufunc with a pandas object as `where` recursed infinitely (GH#60611)Python · 106 + / 1 −
Introduces 3 new declarations in pandas/core/arraylike.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
pandas/core/arraylike.py ↗ · 11 files
@@ -477,6 +495,49 @@ def _standardize_out_kwarg(**kwargs) -> dict[str, Any]: return kwargs +def _unbox_where(where, axes: dict[str, Any]) -> np.ndarray:+ """+ Convert a Series or DataFrame passed as a ufunc's `where` to an ndarray.++ It must be labeled identically to the (aligned) inputs; we raise rather+ than guess between label-based and positional matching.+ """+ same_axes = where.ndim == len(axes) and all(+ ax.equals(other) for ax, other in zip(where.axes, axes.values(), strict=True)+ )+ if not same_axes:+ raise ValueError(+ "The ufunc 'where' argument must have the same axes as the aligned inputs"+ )+ return _where_to_ndarray(where)+++def _where_to_ndarray(where) -> np.ndarray:+ # checked for every dtype: np.putmask (the `out=` path) and a Categorical's+ # to_numpy(dtype=bool) would both treat a missing value as True+ if isna(where).any(axis=None):+ raise ValueError("The ufunc 'where' argument cannot contain missing values")+ dtypes = where.dtypes if where.ndim == 2 else [where.dtype]+ if not all(is_bool_dtype(dtype) for dtype in dtypes):+ # left for numpy to validate; np.putmask, used with `out=`, is laxer+ return np.asarray(where)+ return where.to_numpy(dtype=bool)+++def dispatch_where_only_ufunc(self, ufunc: np.ufunc, method: str, *inputs, **kwargs):