[New-bugs-announce] [issue13226] Expose RTLD_* constants in the posix module

STINNER Victor report at bugs.python.org
Thu Oct 20 00:05:44 CEST 2011

New submission from STINNER Victor <victor.stinner at haypocalc.com>:

We have a sys.setdlopenflags() function, but required constants are not available on all platforms. The DLFCN is only available on Linux and sunos5 (is plat-sunos5 available for all Solaris and OpenIndiana versions?), but not on OpenBSD, FreBSD, Mac OS X, ... whereas these platforms have the sys.setdlopenflags() function.

My patch contains 7 constants: 

 - RTLD_DEEPBIND (glibc >= 2.3)

The ctypes has two RTDL constants: RTLD_LOCAL and RTLD_GLOBAL. The 2 constants are always available, even if the platform doesn't support them! Extract of _ctypes.c:
/* If RTLD_LOCAL is not defined (Windows!), set it to zero. */
#ifndef RTLD_LOCAL
#define RTLD_LOCAL 0

/* If RTLD_GLOBAL is not defined (cygwin), set it to the same value as

Lib/plat-sunos5/DLFCN.py contains 25 constants, only 6 are available in my patch. I don't think that we should expose all constants.

Using Google Codesearch, I only found one user of RTLD constants (of the DLFCN module). It's PyKDE4 who calls:


I guess that the 7 constants should be enough for everyone :-) We may add more later on demand. You can add your own constant to your program if you really need a special option on a specific platform.

components: Library (Lib)
files: posix_rtld.patch
keywords: patch
messages: 145975
nosy: haypo
priority: normal
severity: normal
status: open
title: Expose RTLD_* constants in the posix module
versions: Python 3.3
Added file: http://bugs.python.org/file23472/posix_rtld.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list