Python Glossary Русский

all Python 3Linux · macOSsysfunction

sys.getdlopenflags()

interpreter

Returns the dlopen() flags the interpreter uses to load C extension modules. Unix only (Linux, macOS); os.RTLD_NOW by default.

Syntax

sys.getdlopenflags()

It is mostly for debugging how extensions that share symbols get loaded. The flags are a bit mask, so test them against the os.RTLD_* constants with &, not ==. Windows lacks the function (AttributeError). Libraries loaded through ctypes use their own mode argument, not these flags.

Examples

import os, sys
flags = sys.getdlopenflags()
print(flags == os.RTLD_NOW)  # → ? True — значение по умолчанию
print(bool(flags & os.RTLD_GLOBAL))  # → False

See also

Open in the full glossarydocs.python.orgReport an inaccuracy