Daily edition

Sep 19, 2026

The edition exactly as it was published. Nothing here is re-selected on a later reading.

Sep 20, 20265 reads · 81 merged PRs screened

language design

rust-lang/rust · #162873

Files changed →View PR ↗

Adjust `bug!`/`span_bug!` emissionRust · 55 + / 21

Introduces 7 new declarations in compiler/rustc_span/src/macros.rs.

Adds new language design rather than adjusting what was there. Tests changed with it, with code of their own.

compiler/rustc_span/src/macros.rs · 10 files

@@ -40,12 +44,32 @@ pub macro span_bug($span:expr, $($arg:tt)+){  #[cold] #[track_caller]-pub fn bug_impl(span: Option<Span>, args: fmt::Arguments<'_>, location: &Location<'_>) -> ! {-    (*EMIT_BUG_DIAGNOSTIC)(span, args, location);-    panic!("{args}")+pub fn bug_impl(+    span: Option<Span>,+    args: fmt::Arguments<'_>,+    location: &'static Location<'static>,+) -> ! {+    // Emit the bug without aborting.+    let emitted = (*EMIT_BUG_DIAGNOSTIC)(span, args, location);++    if emitted {+        // Panic with `ExplicitBug`, which tells `report_ice` that it's expected, e.g. originating+        // from `bug!` or `dcx.emit_bug(..)`.+        panic_any(ExplicitBug);+    } else {+        // Panic with just a string, which means it's unexpected.+        panic_any(format!("{args}"));+    } } -pub static EMIT_BUG_DIAGNOSTIC: AtomicRef<fn(Option<Span>, fmt::Arguments<'_>, &Location<'_>)> =-    AtomicRef::new(&(default_emit_diagnostic as _));+pub static EMIT_BUG_DIAGNOSTIC: AtomicRef<+    fn(Option<Span>, fmt::Arguments<'_>, &'static Location<'static>) -> bool,+> = AtomicRef::new(&(default_emit_bug_diagnostic as _)); -fn default_emit_diagnostic(_: Option<Span>, _: fmt::Arguments<'_>, _: &Location<'_>) {}+fn default_emit_bug_diagnostic(+    _: Option<Span>,

core implementation

TheAlgorithms/Python · #13475

Files changed →View PR ↗

Euler project solution 60Python · 246 + / 0

Introduces 7 new declarations in project_euler/problem_060/sol1.py.

Adds new core implementation rather than adjusting what was there. Read the linked PR for the surrounding test context.

project_euler/problem_060/sol1.py · 3 files

@@ -0,0 +1,246 @@+"""+Project Euler Problem 60: https://projecteuler.net/problem=60++# Problem Statement:++The primes 3, 7, 109, and 673 are quite remarkable. By taking any two primes+and concatenating them in any order the result will always be prime.+For example, taking 7 and 109, both 7109 and 1097 are prime.+The sum of these four primes, 792, represents the lowest sum for a set of four primes+with this property.+Find the lowest sum for a set of five primes for which any two primes concatenate+to produce another prime.++# Solution Explanation:++The brute force approach would be to check all combinations of 5 primes and check+if they satisfy the concatenation property. However, this is computationally+expensive. Instead, we can use a backtracking approach to build sets of primes+that satisfy the concatenation property. We can further optimize by using property+of divisibility by 3 to eliminate certain candidates and memoization to avoid+redundant prime checks.+Throughout the code, we have used a parameter flag to indicate whether+we are working with primes that are congruent to 1 or 2 modulo 3.+This helps in reducing the search space.++## Eliminating candidates using divisibility by 3:+Consider any 2 primes p1 and p2 that are not divisible by 3. If p1 divided by 3+gives a remainder of 1 and p2 divided by 3 gives a remainder of 2, then+the concatenated number p1p2 will be divisible by 3 and hence not prime.+This can be easily proven using the property of modular arithmetic.+    Consider p1 ≡ 1 (mod 3) and p2 ≡ 2 (mod 3). Define a1 = p1, b1 = 1, a2 = p2, b2 = 2.+    concat(p1, p2) = (p1 * 10^k + p2) where k is the number of digits in p2.+    Now, (p1 * 10^k + p2) mod 3 = ((p1 * 10^k) + p2) mod 3

runtime

nodejs/node · #66064

Files changed →View PR ↗

buffer: add Buffer.stringLength()C++ · 124 + / 0

Introduces 1 new declaration in src/node_buffer.cc.

Adds new runtime rather than adjusting what was there. Tests changed with it, with code of their own.

src/node_buffer.cc · 5 files

@@ -1409,6 +1409,94 @@ static bool FastIsAscii(Local<Value> receiver,  static CFunction fast_is_ascii(CFunction::Make(FastIsAscii)); +// Number of UTF-16 code units produced by decoding [p, end) as UTF-8 with+// WHATWG "maximal subpart" U+FFFD replacement, matching the fallback that+// StringBytes::Encode takes for invalid input (v8::String::NewFromUtf8).+static size_t Utf16LengthFromInvalidUtf8(const uint8_t* p, const uint8_t* end) {+  size_t units = 0;+  while (p < end) {+    const uint8_t lead = *p;+    if (lead < 0x80) {+      p++;+      units++;+      continue;+    }+    size_t len;+    uint8_t lo = 0x80;+    uint8_t hi = 0xBF;+    if (lead >= 0xC2 && lead <= 0xDF) {+      len = 2;+    } else if (lead >= 0xE0 && lead <= 0xEF) {+      len = 3;+      if (lead == 0xE0) lo = 0xA0;+      if (lead == 0xED) hi = 0x9F;+    } else if (lead >= 0xF0 && lead <= 0xF4) {+      len = 4;+      if (lead == 0xF0) lo = 0x90;+      if (lead == 0xF4) hi = 0x8F;+    } else {+      // Invalid lead byte: one replacement character.+      p++;+      units++;+      continue;

runtime

ggml-org/llama.cpp · #29084

Files changed →View PR ↗

test-llama-archs : generate dummy test vocabC++ · 72 + / 13

Introduces 1 new declaration in src/llama-vocab.cpp.

Adds new runtime rather than adjusting what was there. Tests changed with it, with code of their own.

src/llama-vocab.cpp · 4 files

@@ -3595,6 +3609,42 @@ std::vector<llama_token> llama_vocab::impl::tokenize(                     }                 }             } break;+        case LLAMA_VOCAB_TYPE_TEST:+            {+                const uint32_t n_vocab = vocab.n_tokens();+                constexpr size_t chunk_size = 5;++                // reserve output to avoid repeated reallocations+                size_t n_tokens = 0;+                for (const auto & fragment : fragment_buffer) {+                    if (fragment.type == FRAGMENT_BUFFER_VARIANT_TYPE_RAW_TEXT) {+                        n_tokens += (fragment.length + chunk_size - 1) / chunk_size;+                    } else {+                        ++n_tokens;+                    }+                }+                output.reserve(output.size() + n_tokens);++                for (const auto & fragment : fragment_buffer) {+                    if (fragment.type == FRAGMENT_BUFFER_VARIANT_TYPE_RAW_TEXT) {+                        const auto & text = fragment.raw_text;+                        const size_t begin = fragment.offset;+                        const size_t end   = begin + fragment.length;+                        size_t pos = begin;+                        while (pos < end) {+                            const size_t n = std::min(chunk_size, end - pos);+                            uint64_t hash = 0;+                            for (size_t i = 0; i < n; ++i) {+                                hash = hash*31 + (uint8_t) text[pos + i];+                            }+                            output.push_back((llama_token)(hash % n_vocab));+                            pos += n;

core implementation

pandas-dev/pandas · #66625

Files changed →View PR ↗

PERF: Arrow-backed groupby reductions avoid converting results through NumPyPython · 22 + / 30

Reworks 37 lines of existing logic in pandas/core/arrays/arrow/array.py.

Changes how existing core implementation behaves. Tests changed with it, with code of their own.

pandas/core/arrays/arrow/array.py · 3 files

@@ -3471,38 +3471,30 @@ def _groupby_op_pyarrow(             )             result_values = pc.if_else(below_min_count, None, result_values) -        # Scatter results into output array ordered by group id.-        # Fallback to NumPy here due to the limitation of pc.scatter.-        # Another workaround is to use join + sort.-        # TODO: revisit this part when pc.scatter becomes more functionally complete.-        result_group_ids_np = result_group_ids.to_numpy(zero_copy_only=False).astype(-            np.int64, copy=False-        )-        result_values_np = result_values.to_numpy(zero_copy_only=False)+        # Place the results in group-id order: the inverse permutation takes+        # the row holding group i, and is null where group i had no rows.+        group_ids_np = result_group_ids.to_numpy(zero_copy_only=False)+        inverse = np.full(ngroups, -1, dtype=np.int64)+        inverse[group_ids_np] = np.arange(len(group_ids_np))+        indices = pa.array(inverse, mask=inverse < 0)++        if how in ["sum", "prod"] and pa.types.is_decimal(output_type):+            try:+                # take would carry an out-of-precision decimal through silently+                result_values.validate(full=True)+            except pa.ArrowInvalid:+                # needs more digits than the maximum precision, so let the+                # caller fall back to a type that can hold it+                return None -        default_py = default_value.as_py()-        try:-            if default_py is not None and min_count == 0:-                # Fill missing groups with identity element-                output_np = np.full(ngroups, default_py, dtype=result_values_np.dtype)-                output_np[result_group_ids_np] = result_values_np

Read today’s edition →