Skip to content

OOM on numpy in dict with an update #11252

@tjni

Description

@tjni

Describe the bug

I can get pyright 1.1.408 to OOM on a small (kind of weird) code snippet.

Code or Screenshots

Claude Code helped me bisect and minimize this reproducer.

With uv installed:

#!/bin/bash
set -e
REPRO_DIR=$(mktemp -d)
cd "$REPRO_DIR"

cat >pyright_oom.py <<'EOF'
def trigger_oom() -> dict:
    import numpy as np
    result = {"np": np}
    result.update({
        "str": str, "int": int, "float": float, "bool": bool,
        "list": list, "dict": dict, "set": set, "tuple": tuple,
        "frozenset": frozenset, "bytes": bytes, "bytearray": bytearray,
        "abs": abs, "round": round, "min": min, "max": max,
        "sum": sum, "pow": pow, "divmod": divmod, "len": len,
        "range": range, "enumerate": enumerate, "zip": zip,
        "sorted": sorted, "reversed": reversed, "slice": slice,
        "map": map, "filter": filter, "any": any, "all": all, "type": type,
    })
    return result
EOF

cat >pyrightconfig.json <<'EOF'
{"venvPath": ".", "venv": ".venv", "pythonVersion": "3.12"}
EOF

uv venv .venv
uv pip install numpy --quiet
echo "Running pyright in $REPRO_DIR (will OOM after ~60-90s)..."
time uvx pyright pyright_oom.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions