Skip to content

Builds outside source folder broken, failed import of _importlib - no detection or valid error message or recommended cleanup. #112305

Closed
@nascheme

Description

@nascheme

Bug description:

This bug was exposed by GH-108716. I think it was not the cause, just that it exposed an existing issue.

The build fails with:

./python -E -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform
Fatal Python error: _PyImport_InitCore: failed to initialize importlib
Python runtime state: preinitialized
ImportError: Frozen object named '_frozen_importlib' is invalid

Current thread 0x00007fb629644740 (most recent call first):
  <no Python frame>
make: *** [Makefile:932: platform] Error 1

Likely python doesn't know to look in $(srcdir)/Lib for the _importlib library. It probably looks in ./Lib/ and that fails.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

Labels

3.11only security fixes3.12only security fixes3.13bugs and security fixesbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions