Skip to content

Documentation of ctypes.CDLL does not correspond to code #86280

Closed

Description

@madphysicist
BPO 42114
Nosy @ambv, @sbraz, @madphysicist, @miss-islington
PRs
  • bpo-42114: ctypes documentation: fix winmode parameter default value #29976
  • [3.10] bpo-42114: ctypes documentation: fix winmode parameter default value (GH-29976) #30037
  • [3.9] bpo-42114: ctypes documentation: fix winmode parameter default value (GH-29976) #30038
  • 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 2021-12-10.23:30:28.672>
    created_at = <Date 2020-10-21.22:02:15.109>
    labels = ['3.11', '3.9', '3.10', 'docs']
    title = 'Documentation of ctypes.CDLL does not correspond to code'
    updated_at = <Date 2021-12-10.23:30:28.659>
    user = 'https://github.com/madphysicist'

    bugs.python.org fields:

    activity = <Date 2021-12-10.23:30:28.659>
    actor = 'lukasz.langa'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2021-12-10.23:30:28.672>
    closer = 'lukasz.langa'
    components = ['Documentation']
    creation = <Date 2020-10-21.22:02:15.109>
    creator = 'madphysicist'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 42114
    keywords = ['patch']
    message_count = 7.0
    messages = ['379261', '379262', '379263', '408252', '408263', '408264', '408265']
    nosy_count = 5.0
    nosy_names = ['docs@python', 'lukasz.langa', 'sbraz', 'madphysicist', 'miss-islington']
    pr_nums = ['29976', '30037', '30038']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue42114'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    Activity

    1. madphysicist commented on Oct 21, 2020

      madphysicistmannequin
      MannequinAuthor

      ctypes.CDLL initializer defined in version 3.8 and beyond as

      def __init__(self, name, mode=DEFAULT_MODE, handle=None,
                   use_errno=False,
                   use_last_error=False,
                   winmode=None):
      

      Documentation says winmode=0:

      class ctypes.CDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=0)
      

      Loading of normal DLL from custom directory works when winmode=0, but when winmode=None To reproduce, any combination of adding the fol += der containing the DLL to os.evia ron['PATH'], os.add_dll_directory(...)

      Discoveryos.pathsep + ... triggered by https://stackoverflow.co, `sys.path.appen

      Worked prior to 3.8 because there was no winmode parameter, and d(...) does not change the behavior.m/q/mode was passed in directly, 59330863/298873ctypes0. .DEFAULT_MODE == 0`.

      I don't know whether it's better to update the code, the docs, or something else, but based on current info, would prefer updating the code.Some info summarized in https://stackoverflow.com/a/{8,9,}64472088/2988730.

      Link to do pagecscorresponding : https://docs.python.org/3.10/library/ctypes.html#ctypes.CDLL
      730.
      Link to GitHub code: https://github.com/python/cpython/blob/3.{8,9}/Lib/ctypes/__init__.py#L340

    2. changed the title [-]Documentation of[/-] [+]Documentation of ctypes.CDLL does not correspond to code[/+] on Oct 21, 2020
    3. madphysicist commented on Oct 21, 2020

      madphysicistmannequin
      MannequinAuthor

      Company firewall mutilated the text. Here is another attempt:

      ctypes.CDLL initializer defined in version 3.8 and beyond as

      def __init__(self, name, mode=DEFAULT_MODE, handle=None,
                   use_errno=False,
                   use_last_error=False,
                   winmode=None):
      

      Documentation says winmode=0:

      class ctypes.CDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=0)
      

      Loading of normal DLL from custom directory works when winmode=0, but not when winmode=None. To reproduce, any combination of adding the folder containing the DLL via os.eviron['PATH'] += os.pathsep + ..., os.add_dll_directory(...), sys.path.append(...) does not change the behavior.

      Worked prior to 3.8 because there was no parameter, and mode` was passed in direcCompany firewall mutilated the text. Here is another attempt:

      ctypes.CDLL initializer defined in version 3.8 and beyond as

      def __init__(self, name, mode=DEFAULT_MODE, handle=None,
                   use_errno=False,
                   use_last_error=False,
                   winmode=None):
      

      Documentation says winmode=0:

      class ctypes.CDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=0)
      

      Loading of normal DLL from custom directory works when winmode=0, but not when winmode=None. To reproduce, any combination of adding the folder containing the DLL via os.eviron['PATH'] += os.pathsep + ..., os.add_dll_directory(...), sys.path.append(...) does not change the behavior.

      Worked prior to 3.8 because there was no winmode parameter, mode was passed in diretly, and ctypes.DEFAULT_MODE == 0.

      I don't know whether it's better to update the code, the docs, or something else, but based on current info, would prefer updating the code.

      Discovery triggered by https://stackoverflow.com/q/59330863/2988730.
      Some info summarized in https://stackoverflow.com/a/64472088/2988730.

      yink to docs: https://docs.python.org/3.{8,9,10}/library/ctypes.html#ctypes.CDLL
      Link to GitHub code: https://github.com/python/cpython/blob/3.{8,9}/Lib/ctypes/__init__.py#L340t.ly, ctyp. .DEFAULT_MODE == 0.
      I don't know whether it's better to update the code, the docs, or something else, but based on current info, would prefer updating the code.

      Discovery triggered by https://stackoverflow.com/q/59330863/2988730.
      Some info summarized in https://stackoverflow.com/a/64472088/2988730.

      yink to docs: https://docs.python.org/3.{8,9,10}/library/ctypes.html#ctypes.CDLL
      Link to GitHub code: https://github.com/python/cpython/blob/3.{8,9}/Lib/ctypes/__init__.py#L340

    4. madphysicist commented on Oct 21, 2020

      madphysicistmannequin
      MannequinAuthor

      Last attempt before I give up:

      ctypes.CDLL initializer defined in version 3.8 and beyond as

      def __init__(self, name, mode=DEFAULT_MODE, handle=None,
                   use_errno=False,
                   use_last_error=False,
                   winmode=None):
      

      Documentation says winmode=0:

      class ctypes.CDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=0)
      

      Loading of normal DLL from custom directory works when winmode=0, but not when winmode=None. To reproduce, any combination of adding the folder containing the DLL via os.eviron['PATH'] += os.pathsep + ..., os.add_dll_directory(...), sys.path.append(...) does not change the behavior.

      Worked prior to 3.8 because there was no winmode parameter, mode was passed in diretly, and ctypes.DEFAULT_MODE == 0.

      I don't know whether it's better to update the code, the docs, or something else, but based on current info, would prefer updating the code.

      Discovery triggered by https://stackoverflow.com/q/59330863/2988730.
      Some info summarized in https://stackoverflow.com/a/64472088/2988730.

      Link to docs: https://docs.python.org/3.{8,9,10}/library/ctypes.html#ctypes.CDLL
      Link to GitHub code: https://github.com/python/cpython/blob/3.{8,9}/Lib/ctypes/__init__.py#L340

    5. ambv commented on Dec 10, 2021

      @ambv
      Contributor

      New changeset c1051e0 by Louis Sautier in branch 'main':
      bpo-42114: ctypes documentation: fix winmode parameter default value (GH-29976)
      c1051e0

    6. ambv commented on Dec 10, 2021

      @ambv
      Contributor

      New changeset f8eebb0 by Miss Islington (bot) in branch '3.9':
      bpo-42114: ctypes documentation: fix winmode parameter default value (GH-29976) (GH-30038)
      f8eebb0

    7. ambv commented on Dec 10, 2021

      @ambv
      Contributor

      New changeset 8f3728e by Miss Islington (bot) in branch '3.10':
      bpo-42114: ctypes documentation: fix winmode parameter default value (GH-29976) (GH-30037)
      8f3728e

    8. ambv commented on Dec 10, 2021

      @ambv
      Contributor

      Thanks! ✨ 🍰 ✨

    9. added
      3.11
      docs
      and removed
      3.8 (EOL)
      on Dec 10, 2021
    10. transferred this issue fromon Apr 10, 2022
    11. CristiFati commented on Jan 7, 2023

      @CristiFati

      I know it's "a bit" late, but this (inaccurate documentation) applies to Python 3.8 as well.

    12. AlexWaygood commented on Jan 7, 2023

      @AlexWaygood
      Member

      I know it's "a bit" late, but this (inaccurate documentation) applies to Python 3.8 as well.

      I'm afraid the 3.8 branch is now only accepting security-related patches, so we won't be fixing that now :/

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)3.113.9 (EOL)docs

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions