Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose RTLD_* constants in the posix module #57435

Closed
vstinner opened this issue Oct 19, 2011 · 9 comments
Closed

Expose RTLD_* constants in the posix module #57435

vstinner opened this issue Oct 19, 2011 · 9 comments
Labels
stdlib Python modules in the Lib dir

Comments

@vstinner
Copy link
Member

BPO 13226
Nosy @loewis, @vstinner, @jwilk
Files
  • posix_rtld.patch
  • posix_rtld-2.patch
  • 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

    GitHub fields:

    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'

    bugs.python.org fields:

    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']

    @vstinner
    Copy link
    Member Author

    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_LAZY
    • RTLD_NOW
    • RTLD_GLOBAL
    • RTLD_LOCAL
    • RTLD_NODELETE
    • RTLD_NOLOAD
    • 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
    #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:

       sys.setdlopenflags(DLFCN.RTLD_NOW|DLFCN.RTLD_GLOBAL)

    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.

    @vstinner vstinner added the stdlib Python modules in the Lib dir label Oct 19, 2011
    @vstinner
    Copy link
    Member Author

    Updated patch: remove "either" in the documentation. Thanks neologix par the review.

    @neologix
    Copy link
    Mannequin

    neologix mannequin commented Oct 21, 2011

    Note that I'm really +10 on this issue: such constants belong to individual modules rather than to the unmanageable Lib/plat-XXX/.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Oct 21, 2011

    The patch looks fine to me. However, I don't think it meets Charles-François' requirement of moving the constants into an individual module. Rather than living in the unmanageable plat-XXX, they now live in the unmanageable posixmodule.c...

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 25, 2011

    New changeset c75427c0da06 by Victor Stinner in branch 'default':
    Issue bpo-13226: Add RTLD_xxx constants to the os module. These constants can by
    http://hg.python.org/cpython/rev/c75427c0da06

    @Arfrever
    Copy link
    Mannequin

    Arfrever mannequin commented Oct 31, 2011

    Python/sysmodule.c still contains references to DLFCN module.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 31, 2011

    New changeset 05e2bdc00c0c by Victor Stinner in branch 'default':
    Issue bpo-13226: Update sys.setdlopenflags() docstring
    http://hg.python.org/cpython/rev/05e2bdc00c0c

    @vstinner
    Copy link
    Member Author

    vstinner commented Nov 2, 2011

    sys.getdlopenflags() doc and docstring still contain references to ctypes and DLFCN module.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 21, 2013

    New changeset 1da78c7d382b by Andrew Kuchling in branch 'default':
    bpo-13226: update references from ctypes/DLFCN modules to os module
    http://hg.python.org/cpython/rev/1da78c7d382b

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant