Expose RTLD_* constants in the posix module #57435
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee = None closed_at = <Date 2011-10-25.11:34:21.298> created_at = <Date 2011-10-19.22:05:43.706> labels = ['library'] title = 'Expose RTLD_* constants in the posix module' updated_at = <Date 2013-06-21.15:00:42.103> user = 'https://github.com/vstinner'
activity = <Date 2013-06-21.15:00:42.103> actor = 'python-dev' assignee = 'none' closed = True closed_date = <Date 2011-10-25.11:34:21.298> closer = 'vstinner' components = ['Library (Lib)'] creation = <Date 2011-10-19.22:05:43.706> creator = 'vstinner' dependencies =  files = ['23472', '23483'] hgrepos =  issue_num = 13226 keywords = ['patch'] message_count = 9.0 messages = ['145975', '146046', '146067', '146074', '146359', '146671', '146688', '146851', '191589'] nosy_count = 6.0 nosy_names = ['loewis', 'vstinner', 'jwilk', 'Arfrever', 'neologix', 'python-dev'] pr_nums =  priority = 'normal' resolution = 'fixed' stage = None status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue13226' versions = ['Python 3.3']
The text was updated successfully, but these errors were encountered:
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:
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 #endif /* If RTLD_GLOBAL is not defined (cygwin), set it to the same value as RTLD_LOCAL. */ #ifndef RTLD_GLOBAL #define RTLD_GLOBAL RTLD_LOCAL #endif
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.