Skip to content

bpo-42114: ctypes documentation: fix winmode parameter default value #29976

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

Merged
merged 1 commit into from
Dec 10, 2021

Conversation

sbraz
Copy link
Contributor

@sbraz sbraz commented Dec 8, 2021

Hi,

This makes the documentation consistent with the actual implementation. I believe this needs to be backported to 3.8, 3.9 and 3.10 branches.

https://bugs.python.org/issue42114

@bedevere-bot bedevere-bot added the docs Documentation in the Doc dir label Dec 8, 2021
@sbraz sbraz changed the title bpo-34434: ctypes documentation: fix winmode parameter default value bpo-42114: ctypes documentation: fix winmode parameter default value Dec 8, 2021
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@JulienPalard: Would you mind to double check?

@vstinner
Copy link
Member

vstinner commented Dec 8, 2021

Maybe we should mention (in whatsnew) that the default behaviour results in nt._LOAD_LIBRARY_SEARCH_DEFAULT_DIRS being used, which can break library loading with relative paths.

It's documented below:

The winmode parameter is used on Windows to specify how the library is loaded (since mode is ignored). It takes any value that is valid for the Win32 API LoadLibraryEx flags parameter. When omitted, the default is to use the flags that result in the most secure DLL load to avoiding issues such as DLL hijacking. Passing the full path to the DLL is the safest way to ensure the correct library and dependencies are loaded.

You removed your comment, so I guess that I found that section.

I agree that the parameter documentation is far from the function documentation :-( A different option would be to document that OleDLL, WinDLL and PyDLL inherit from CDLL, and move winmode documentation inside CDLL doc.

@ambv ambv added the skip news label Dec 10, 2021
@ambv ambv merged commit c1051e0 into python:main Dec 10, 2021
@miss-islington
Copy link
Contributor

Thanks @sbraz for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@bedevere-bot
Copy link

GH-30037 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Dec 10, 2021
@bedevere-bot
Copy link

GH-30038 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Dec 10, 2021
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 10, 2021
…ythonGH-29976)

Signed-off-by: Louis Sautier <[email protected]>
(cherry picked from commit c1051e0)

Co-authored-by: Louis Sautier <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 10, 2021
…ythonGH-29976)

Signed-off-by: Louis Sautier <[email protected]>
(cherry picked from commit c1051e0)

Co-authored-by: Louis Sautier <[email protected]>
ambv pushed a commit that referenced this pull request Dec 10, 2021
…H-29976) (GH-30038)

Signed-off-by: Louis Sautier <[email protected]>
(cherry picked from commit c1051e0)

Co-authored-by: Louis Sautier <[email protected]>
ambv pushed a commit that referenced this pull request Dec 10, 2021
…H-29976) (GH-30037)

Signed-off-by: Louis Sautier <[email protected]>
(cherry picked from commit c1051e0)

Co-authored-by: Louis Sautier <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants