Skip to content

Serialization crash on pandera with pandas-stubs #18582

Description

@sterliakov

Crash Report

Running mypy on pandera with pandas-stubs installed results in a crash.

Traceback

pandera/api/function_dispatch.py:12: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
Traceback (most recent call last):
  File "/tmp/tmp.KoqC85pWUZ/pandera/.venv/bin/mypy", line 10, in <module>
    sys.exit(console_entry())
             ^^^^^^^^^^^^^^^
  File "/tmp/tmp.KoqC85pWUZ/pandera/.venv/lib/python3.12/site-packages/mypy/__main__.py", line 15, in console_entry
    main()
  File "mypy/main.py", line 109, in main
  File "mypy/main.py", line 193, in run_build
  File "mypy/build.py", line 194, in build
  File "mypy/build.py", line 269, in _build
  File "mypy/build.py", line 2940, in dispatch
  File "mypy/build.py", line 3338, in process_graph
  File "mypy/build.py", line 3465, in process_stale_scc
  File "mypy/build.py", line 2502, in write_cache
  File "mypy/build.py", line 1562, in write_cache
  File "mypy/nodes.py", line 390, in serialize
  File "mypy/nodes.py", line 4049, in serialize
  File "mypy/nodes.py", line 3986, in serialize
  File "mypy/nodes.py", line 3408, in serialize
  File "mypy/types.py", line 678, in serialize
  File "mypy/types.py", line 2467, in serialize
  File "mypy/types.py", line 1495, in serialize
  File "mypy/types.py", line 678, in serialize
  File "mypy/types.py", line 3173, in serialize
AssertionError: Internal error: unresolved placeholder type None

To Reproduce

I'll try to narrow this down later, but now a repro script:

cd $(mktemp -d)
git clone https://github.com/pandera-dev/pandera
cd pandera
git checkout 33fe68b7d0c7c3a760469b9898acf286334fe34f  # Head as of now
python -m venv .venv
. ./.venv/bin/activate
pip install . 'mypy==1.14.1' 'pandas-stubs==2.2.3.241126'
hash -r
mypy pandera --show-traceback

Your Environment

  • Mypy version used: 1.14.1 and current master
  • Mypy command-line flags: n/a
  • Mypy configuration options from mypy.ini (and other config files): as specified in pandera's setup.cfg
  • Python version used: 3.12 and 3.13 tested
  • Operating system and version: Ubuntu 22.04.5 LTS (Linux pc 5.15.0-130-generic #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux)

Activity

  1. hauntsaninja commented on Feb 1, 2025

    @hauntsaninja
    Collaborator

    Likely related to #17396 (comment)
    I had a hacky fix for it, but regressed type checking in some normal cases. If you see a better fix that would be cool!

  2. added a commit that references this issue on Feb 3, 2025
    237933a
  3. added 2 commits that reference this issue on Feb 4, 2025
    85066b8
    ebc2cb8
  4. added a commit that references this issue on Feb 24, 2025
    fc2798d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions