Skip to content

ctypes.util.dllist is no longer used on Windows and macOS (Python 3.14+) #3

Closed

Description

@cakedev0

joblib#250 moved the ctypes.util.dllist import to module level and changed its condition:

# 3.7.0, in _load_libraries
if sys.platform not in ("linux", "emscripten"):
    from ctypes.util import dllist

# master, module level (since #250)
if sys.platform != "emscripten" and (
    # Python 3.15 doesn't have the CFUNCTYPE anymore:
    sys.platform == "linux" and sys.version_info[:2] >= (3, 15)
):
    from ctypes.util import dllist

The new condition is only true on Linux with Python 3.15+, so dllist is now always None on Windows and macOS (permalink). On Python 3.14+, _load_libraries falls back to the Toolhelp enumerator on Windows and to _dyld_* on macOS. 3.7.0 used dllist there (joblib#219, and the 3.7.0 changelog says so).

Checked on macOS arm64, Python 3.14.4, by recording which _find_libraries_* method _load_libraries calls:

3.7.0      darwin 3.14.4 -> ['_find_libraries_with_python']
3.8.0.dev0 darwin 3.14.4 -> ['_find_libraries_with_dyld']

The comment in the condition is about Linux, and the description of joblib#250 only discusses Linux. This looks unintended rather than a decision to stop using dllist on Windows and macOS.

Consequences:

  • Nothing breaks: the fallbacks are the code paths used on Python 3.10–3.13.
  • The RuntimeWarning that FIX intermittent Windows module enumeration failure joblib/threadpoolctl#219 added for dllist failures can no longer be reached on Windows.
  • The Windows 3.14 CI jobs no longer exercise dllist.
  • The stdlib_dllist() helper in tests/test_threadpoolctl.py still mirrors the 3.7.0 condition, so on Windows 3.14 test_windows_library_path_exceeds_internal_limit is skipped even though the Toolhelp path, which applies the limit, is the one that runs.

Suggested fix

if sys.platform != "emscripten" and (
    sys.platform != "linux"
    # On Linux, dllist is only used on free-threaded 3.15+, where the
    # ctypes.util import no longer creates a CFUNCTYPE callback (#225):
    or sys.version_info[:2] >= (3, 15)
):

If dropping dllist on Windows and macOS was intended, the changelog should say so and stdlib_dllist() should be updated instead.

Activity

  1. cakedev0 commented on Oct 29, 2026

    @cakedev0
    OwnerAuthor

    Fixed upstream in joblib#288.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions