python / python/cpython

Default dlopenflags inconsistent between Linux and macOS

Open
#137,880 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

interpreter-core OS-linux OS-mac topic-importlib type-feature
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

Feature or enhancement

Proposal:

The default dlopen flags for loading extension modules specify neither RTLD_GLOBAL nor RTLD_LOCAL.

Unfortunately, the behavior when neither flag is specified differs between Linux and macOS: on Linux, RTLD_LOCAL is the default, while on macOS RTLD_GLOBAL seems to be the default.

POSIX itself is not helpful on the matter: "If neither RTLD_GLOBAL nor RTLD_LOCAL is specified, the default behavior is unspecified".

Having two different behaviors on two extremely popular platforms may make support more difficult for maintainers of complex extension modules that bundle popular third-party C/C++ libraries (here is a possible instance).

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with CPython's extension-module loading path and the linked dlopen specifications for Linux, macOS, and POSIX. Determine the intended explicit default behavior, then verify that extension loading is consistent across both platforms and that relevant existing coverage still passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.