Skip to content

CPython assertion error Py_REFCNT when running compiled mypy #21859

Description

@johnyf

Crash Report

Running mypy example.py results in a CPython assertion error.

Traceback

python: ./Include/internal/pycore_dict.h:288: _PyDict_NotifyEvent: Assertion `Py_REFCNT((PyObject*)mp) > 0' failed.
Aborted

Passing --show-traceback results in the same error, without additional information.

To Reproduce

Create a file example.py that contains:

def f(x):
    pass

Run:

mypy example.py

This error is only when using the compiled version of mypy. The pure Python version (installed with pip install --no-binary mypy mypy) works without errors.

Your Environment

  • mypy 2.3.1 (compiled: yes) (installed from PyPI)
  • no command-line flags
  • no mypy.ini file
  • Python 3.14.7+ (heads/3.14:1b1c61a94f0, Aug 8 2026, 07:47:02) [GCC 14.2.0] on linux
    (Python was compiled using ./configure ... --with-assertions)
  • Linux Debian 13

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions