Skip to content

Builds Without HAVE_DYNAMIC_LOADING Set Still Expose Features and API Related to Dynamic Modules #122950

Open
@ericsnowcurrently

Description

@ericsnowcurrently

Bug report

Bug description:

When CPython is built without HAVE_DYNAMIC_LOADING set, we currently leave out a small handful of code in Python/import.c and Python/importdl.c. However, there is a bunch more that should probably be excluded (via #ifdef HAVE_DYNAMIC_LOADING):

  • some functions and constants in Python/importdl.c and Include/internal/pycore_importdl.h
  • some functions, constants, and state in Python/import.c and Include/internal/pycore_import.h
  • some code in Lib/importlib/_bootstrap_external.py
  • maybe some code in Objects/moduleobject.c
  • builds for Modules/Setup.stdlib
  • checks in Tools/build/check_extension_modules.py
  • modules listed by Tools/build/generate_stdlib_module_names.py

(Also see gh-122907.)

Getting this all correct would probably take a fair amount of effort. Perhaps the big question is would it be worth addressing all these cases?

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixesextension-modulesC modules in the Modules dirinterpreter-core(Objects, Python, Grammar, and Parser dirs)topic-importlibtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions