Skip to content

[panic] Panic in assignment to superclass method #2597

@AA-Turner

Description

@AA-Turner

Consider:

# bug.py
from pandas.core.groupby.generic import DataFrameGroupBy
from pandas.core.groupby.groupby import GroupBy

assert GroupBy._cython_agg_general is DataFrameGroupBy._cython_agg_general


class DFGB(DataFrameGroupBy):
    _cython_agg_general = GroupBy._cython_agg_general

Running ty yields:

RUST_BACKTRACE=1 uvx --with pandas ty check bug.py
error[panic]: Panicked at crates/ruff_db/src/parsed.rs:210:13 when checking `bug.py`: `index out of bounds: the len is 25 but the index is 4000`
info: This indicates a bug in ty.
info: If you could open an issue at https://github.com/astral-sh/ty/issues/new?title=%5Bpanic%5D, we'd be very appreciative!
info: Platform: macos aarch64
info: Version: 0.0.13 (fc1478bd9 2026-01-21)
info: Args: ["ty", "check", "bug.py"]
info: Backtrace:
   0: __mh_execute_header
   1: __mh_execute_header
   2: __mh_execute_header
   3: __mh_execute_header
   4: __mh_execute_header
   5: __mh_execute_header
   6: __mh_execute_header
   7: __mh_execute_header
   8: __mh_execute_header
   9: __mh_execute_header
  10: __mh_execute_header
  11: __mh_execute_header
  12: __mh_execute_header
  13: __mh_execute_header
  14: __mh_execute_header
  15: __mh_execute_header
  16: __mh_execute_header
  17: __mh_execute_header
  18: __mh_execute_header
  19: __mh_execute_header
  20: __mh_execute_header
  21: __mh_execute_header
  22: __mh_execute_header
  23: __mh_execute_header
  24: __mh_execute_header
  25: __mh_execute_header
  26: __mh_execute_header
  27: __pthread_cond_wait

info: query stacktrace:
   0: infer_scope_types_impl(Id(1000))
             at crates/ty_python_semantic/src/types/infer.rs:192
   1: check_file_impl(Id(c00))
             at crates/ty_project/src/lib.rs:554


Found 1 diagnostic
WARN A fatal error occurred while checking some files. Not all project files were analyzed. See the diagnostics list above for details.

I failed to make this a reproducer without pandas due to time, sorry.

$ uvx ty version
ty 0.0.13 (fc1478bd9 2026-01-21)

Thanks,
Adam

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfatala fatal error (panic or crash)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions