Skip to content

Commit b0a82fc

Browse files
jbrockmendelclaude
andauthored
BUG: fix segfault in Rolling method='table' sum/mean/median/min/max (#65273)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 13ffb5f commit b0a82fc

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

doc/source/whatsnew/v3.1.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ Groupby/resample/rolling
318318
- Bug in :meth:`.GroupBy.any` and :meth:`.GroupBy.all` returning ``NaN`` with ``float64`` dtype for unobserved categorical groups on NumPy ``bool`` data instead of the boolean identity value with ``bool`` dtype (:issue:`65100`)
319319
- Bug in :meth:`.Rolling.skew` and :meth:`.Rolling.kurt` (and their :class:`GroupBy` counterparts) returning ``0.0`` and ``-3.0`` respectively for degenerate windows or groups; these now return ``NaN`` (:issue:`62864`)
320320
- Bug in :meth:`.Rolling.skew` and :meth:`.Rolling.kurt` returning ``NaN`` for low-variance windows (:issue:`62946`)
321+
- Bug in :meth:`.Rolling.sum`, :meth:`.Rolling.mean`, :meth:`.Rolling.median`, :meth:`.Rolling.min`, and :meth:`.Rolling.max` with ``method="table"``, ``engine="numba"``, and ``engine_kwargs={"parallel": True}`` could cause a segfault (:issue:`40454`)
321322
- Bug in :meth:`.SeriesGroupBy.ohlc` ignoring ``as_index=False`` (:issue:`65140`)
322323
- Bug in :meth:`DataFrame.groupby` with a :class:`Grouper` with ``freq`` raising ``AttributeError`` when all grouping keys are ``NaT`` (:issue:`43486`)
323324
- Bug in :meth:`Series.resample` and :meth:`DataFrame.resample` where same-frequency resampling with monthly, quarterly, or annual frequencies bypassed aggregation, returning the original values instead of the aggregation result (:issue:`18553`)

pandas/core/window/numba_.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,11 @@ def generate_manual_numpy_nan_agg_with_axis(nan_func):
242242
else:
243243
numba = import_optional_dependency("numba")
244244

245-
@numba.jit(nogil=True, parallel=True)
245+
# Not jitted directly: this is passed through jit_user_function in
246+
# generate_numba_table_func, which wraps it with register_jitable so it
247+
# inlines into roll_table's outer jit. A standalone @jit(parallel=True)
248+
# here nests parallel regions and crashes the workqueue threading layer
249+
# on platforms without tbb/openmp (GH#40454).
246250
def nan_agg_with_axis(table):
247251
result = np.empty(table.shape[1])
248252
for i in numba.prange(table.shape[1]):

0 commit comments

Comments
 (0)