Selected changesmerged Nov 1, 2026
BUG: f2py: mask string literals in depend harvest and fix sort orderPython · 100 + / 17 −
Introduces 3 new declarations in numpy/f2py/crackfortran.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
numpy/f2py/crackfortran.py ↗ · 8 files
@@ -2129,6 +2147,49 @@ def postcrack(block, args=None, tab=''): return block +def _sort_cyclic_dependents(dep, vars):+ """Order one cyclic depend group by real dependency edges.++ ``sortvarnames`` calls this only after a cycle has been reported.+ The usual f2py cycle is an input array dimensioned by hide scalars+ that are computed from that array (``n = shape(a, ...)``,+ ``lda = MAX(1, n)``). Those array-to-hide edges are dropped so+ ``getarrdims`` can blank them, and every remaining edge is honored+ by a topological sort. An initializer therefore runs after the+ names it uses, independent of declaration order.++ A cycle that is not one of those shape back-edges is left in+ ``dep`` order. The caller has already reported it. This function+ does not recurse.+ """+ remaining = set(dep)++ def blocking(name):+ var = vars[name]+ blocked_by = []+ for dep_name in var.get('depend') or []:+ if dep_name not in remaining or dep_name == name:+ continue+ target = vars.get(dep_name, {})+ # Dimension back-edge onto a hide value or an initializer.+ if (isarray(var) and isintent_nothide(var)+ and (isintent_hide(target) or '=' in target)):+ continue+ blocked_by.append(dep_name)+ return blocked_by
Refactor box downcasting methodsRust · 52 + / 43 −
Introduces 6 new declarations in library/alloc/src/boxed/convert.rs.
Adds new language design rather than adjusting what was there. Tests changed with it, with code of their own.
library/alloc/src/boxed/convert.rs ↗ · 6 files
@@ -711,21 +717,24 @@ impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + 'a> { } } +impl<T: Error + ?Sized + 'static, A: Allocator> Box<T, A> {+ fn downcast_error<Dst: 'static>(this: Self) -> Result<Box<Dst, A>, Self> {+ if core::error::error_type_id::<T>(&this) == core::any::TypeId::of::<Dst>() {+ // SAFETY: The type is correct+ Ok(unsafe { Self::cast_unchecked(this) })+ } else {+ Err(this)+ }+ }+}+ impl dyn Error { /// Attempts to downcast the box to a concrete type. #[inline] #[stable(feature = "error_downcast", since = "1.3.0")] #[rustc_allow_incoherent_impl] pub fn downcast<T: Error + 'static>(self: Box<Self>) -> Result<Box<T>, Box<dyn Error>> {- if self.is::<T>() {- // SAFETY: Check ensures the type is correct.- unsafe {- let raw: *mut dyn Error = Box::into_raw(self);- Ok(Box::from_raw(raw as *mut T))- }- } else {- Err(self)- }+ Box::downcast_error(self) } }
ENH: add Series.dt.shift (GH#31705)Python · 71 + / 0 −
Introduces 1 new declaration in pandas/core/indexes/accessors.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
pandas/core/indexes/accessors.py ↗ · 4 files
@@ -134,6 +137,74 @@ def _delegate_method(self, name: str, *args, **kwargs): self._parent ) + def shift(self, periods: int = 1, freq: Frequency | None = None) -> Series:+ """+ Shift the values by desired number of time frequency increments.++ Unlike :meth:`Series.shift`, which moves values to different positions,+ this adds ``periods * freq`` to each value, like :meth:`DatetimeIndex.shift`.++ Parameters+ ----------+ periods : int, default 1+ Number of periods (or increments) to shift by,+ can be positive or negative.+ freq : pandas.DateOffset, pandas.Timedelta or str, optional+ Frequency increment to shift by. If None, the frequency inferred+ from the values (see :attr:`Series.dt.freq`) is used, so values in+ descending order move backward for positive ``periods``. Must be+ None for period values, which are shifted by their own frequency.++ Returns+ -------+ Series+ Series with the shifted values, indexed like the original Series.++ Raises+ ------+ NullFrequencyError+ If ``freq`` is None, ``periods`` is nonzero, and no frequency can+ be inferred from the values.+ TypeError+ If ``freq`` is passed for period values.
Exec the command in TerminalSubprocess instead of running subprocess.run in the forkPython · 58 + / 26 −
Introduces 1 new declaration in panel/widgets/terminal.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
panel/widgets/terminal.py ↗ · 3 files
@@ -106,21 +110,43 @@ def run(self, *args, **kwargs): if self.kwargs: kwargs = {**self.kwargs, **kwargs} + for key in sorted(set(kwargs) - self._exec_kwargs):+ deprecated(+ '2.0', f'TerminalSubprocess kwarg {key}',+ extra=(+ f"The command is now executed directly, so {key!r} is ignored. "+ f"Only {sorted(self._exec_kwargs)} are supported."+ )+ )+ del kwargs[key]++ argv = [args] if isinstance(args, str) else list(args)+ if kwargs.get('shell'):+ argv = ['/bin/sh', '-c', *argv]+ executable = kwargs.get('executable') or argv[0]+ # A fork is an operation whereby a process creates a copy of itself # The two processes will continue from here as a PARENT and a CHILD process (child_pid, fd) = pty.fork() if child_pid == 0:- # This is the CHILD process fork.- # Anything printed here will show up in the pty, including the output- # of this subprocess- # The process will end by printing 'CompletedProcess(...)' to signal to the parent- # that it finished.+ # This is the CHILD process fork. The command replaces this process+ # so that none of the parent's atexit handlers or finalizers can run.+ # Anything printed here will show up in the pty. try:- result = subprocess.run(args, **kwargs)
Watchcache watch test parallelGo · 89 + / 43 −
Reworks 117 lines of existing logic in staging/src/k8s.io/apiserver/pkg/storage/testing/watcher_tests.go.
Changes how existing framework internals behaves. Read the linked PR for the surrounding test context.
staging/src/k8s.io/apiserver/pkg/storage/testing/watcher_tests.go ↗ · 3 files
@@ -2846,9 +2852,59 @@ func RunTestWatchResync(ctx context.Context, t *testing.T, store storage.Interfa expectEtcd: []watch.Event{added(pod1), initialBookmarkWithPod1RV, added(pod2), added(pod3)}, expectCacher: []watch.Event{added(pod1), initialBookmarkWithPod1RV, added(pod2), added(pod3), bookmarkWithPod3RV}, },+ {+ name: "label selector, allowWatchBookmarks=true, sendInitialEvents=true, RV=unset",+ allowWatchBookmarks: true,+ sendInitialEvents: ptr.To(true),+ pred: storage.SelectionPredicate{Label: labels.SelectorFromSet(labels.Set{"foo": "bar"})},+ expectEtcd: []watch.Event{added(pod1), initialBookmarkWithPod1RV, added(pod3)},+ expectCacher: []watch.Event{added(pod1), initialBookmarkWithPod1RV, added(pod3), bookmarkWithPod3RV},+ },+ {+ name: "indexed field selector, allowWatchBookmarks=true, sendInitialEvents=true, RV=unset",+ allowWatchBookmarks: true,+ sendInitialEvents: ptr.To(true),+ pred: storage.SelectionPredicate{Field: fields.ParseSelectorOrDie("spec.nodeName=node-1"), IndexFields: []string{"spec.nodeName"}},+ expectEtcd: []watch.Event{added(pod1), initialBookmarkWithPod1RV, added(pod3)},+ expectCacher: []watch.Event{added(pod1), initialBookmarkWithPod1RV, added(pod3), bookmarkWithPod3RV},+ },+ {+ name: "indexed field selector, allowWatchBookmarks=true, sendInitialEvents=true, RV=beforeResync",+ rv: rvBeforeResync,+ allowWatchBookmarks: true,+ sendInitialEvents: ptr.To(true),+ pred: storage.SelectionPredicate{Field: fields.ParseSelectorOrDie("spec.nodeName=node-1"), IndexFields: []string{"spec.nodeName"}},+ expectCacher: []watch.Event{added(pod1), initialBookmarkWithPod2RV, added(pod3), bookmarkWithPod3RV},+ },+ {+ name: "non-indexed field selector, allowWatchBookmarks=false, sendInitialEvents=false, RV=beforeTest",+ rv: rvBeforeTest,+ sendInitialEvents: ptr.To(false),+ pred: storage.SelectionPredicate{Field: fields.ParseSelectorOrDie("metadata.name=pod-2")},+ expect: []watch.Event{added(pod2)},