Skip to content

ImportError: dynamic module does not define module export function #19531

@greenteahamburgerdeeee

Description

@greenteahamburgerdeeee

Bug Report

When mypy is built with mold linker and LTO (both are necessary i.e. no error with mold + no LTO or bfd + LTO), mypy fails with ImportError: dynamic module does not define module export function.

To Reproduce

Run mypy.

Expected Behavior

No ImportError

Actual Behavior

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.13/mypy", line 5, in <module>
    from mypy.__main__ import console_entry
ImportError: dynamic module does not define module export function (PyInit_edfc647aaf02b20aa651__mypyc)

Your Environment

  • Mypy version used: 1.17.0
  • Mypy command-line flags: The error occurs regardless of flags.
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.13.5
  • System: Gentoo
  • emerge --info dev-python/mypy:
dev-python/mypy-1.17.0::gentoo was built with the following:
USE="debug native-extensions -test" PYTHON_TARGETS="python3_13 -python3_11 -python3_12"
CFLAGS="-march=native -flto=auto -Og -ggdb -pipe -Wl,-O1 -Wl,--as-needed -fuse-ld=mold"
CXXFLAGS="-march=native -flto=auto -Og -ggdb -pipe -Wl,-O1 -Wl,--as-needed -fuse-ld=mold"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks export-pms-vars fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news nostrip parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -fuse-ld=mold -march=native -flto=auto -Og -ggdb -pipe"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions