Skip to content

Pyright recursion in protocol matching on scikit-learn 1.8 aborts indexing (RangeError: Maximum call stack size exceeded) #228

Description

@montmanu

scip-python 0.6.6 overflows the stack while type checking a file that calls into scikit-learn 1.8.0, and in CI the overflow ends the whole run with "Experienced Fatal Error While Indexing". We see the same thing with scipy 1.18.0.

Repro, Python 3.12, with scikit-learn==1.8.0 in a venv:

from sklearn.metrics import cohen_kappa_score, precision_recall_fscore_support


def score(human: list[int], judge: list[int]) -> tuple[float, float]:
    p, r, f, _ = precision_recall_fscore_support(human, judge, average="binary", zero_division=0)
    return float(cohen_kappa_score(human, judge)), float(f)

scip-python index . --project-name=x --environment=env.json logs An internal error occurred while type checking file ...: RangeError: Maximum call stack size exceeded, and the trace goes through assignClassToProtocol and mroClass in protocols.ts.

Raising V8's stack doesn't help: at --stack-size=4000 it still overflows, and at 30000 or 60000, with ulimit -s 65520, the process runs out of memory, so the recursion looks unbounded rather than deep.

Locally the run logs "Analysis partially failed" and still writes an index, but on GitHub Actions (ubuntu-latest, Node 22) the same failure is fatal for the run. We work around it by excluding the affected files in pyrightconfig.json.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions