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

bpo-30470: Deprecate invalid ctypes call protection on Windows. #1810

Merged
merged 2 commits into from May 27, 2017

Conversation

Mariatta
Copy link
Member

Calling Ctypes functions is deprecated in 3.6.2 and will be removed in 3.7

@Mariatta Mariatta added the docs Documentation in the Doc dir label May 25, 2017
@mention-bot
Copy link

@Mariatta, thanks for your PR! By analyzing the history of the files in this pull request, we identified @birkenfeld, @benjaminp and @theller to be potential reviewers.

@Mariatta
Copy link
Member Author

@zooba @Haypo or @ned-deily can one of you review please? I'm not sure if I'm doing this right. Thanks :)


Calling :mod:`ctypes` functions is deprecated. Calling a native function
with incorrect arguments is unsupported and can easily cause
information leakage or code execution vulnerabilities.

Choose a reason for hiding this comment

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

This comment suggests that ctypes functions cannot be called, i.e. that the GetModuleHandleA() call in the next paragraph will soon be unsupported.

Perhaps move this deprecation warning down below the "ctypes tries to protect you from calling functions with the wrong number of arguments" paragraph (line 164/170) and reword as "This protection against incorrect arguments is deprecated and will be removed."

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. I'd get really specific here with something like "Calling ctypes functions with incorrect arguments, either number or type, is unsupported and may no longer raise a ValueError."

It might even make more sense to insert the note directly above the paragraph below that says "ctypes tries to protect you...". Or just remove that section and add a note saying "ctypes may raise a ValueError after calling the function if it detects that an invalid number of arguments were passed. This behavior is deprecated, should not be relied upon, and will be removed in Python 3.7"

@Mariatta
Copy link
Member Author

Thanks @Syeberman and @zooba. I made the change as you suggested. Please check.
I'll resolve the conflict once you're ok with this change.

Calling Ctypes functions is deprecated in 3.6.2 and will be removed in 3.7
@Mariatta
Copy link
Member Author

Resolved the conflict

@Syeberman
Copy link

LGTM

@Mariatta Mariatta merged commit f931fd1 into python:master May 27, 2017
@Mariatta Mariatta deleted the deprecate-ctypes branch May 27, 2017 14:23
Mariatta added a commit to Mariatta/cpython that referenced this pull request May 27, 2017
…pythonGH-1810)

Calling Ctypes functions is deprecated in 3.6.2 and will be removed in 3.7.
(cherry picked from commit f931fd1)
Mariatta added a commit that referenced this pull request May 27, 2017
…GH-1810) (GH-1833)

Calling Ctypes functions is deprecated in 3.6.2 and will be removed in 3.7.
(cherry picked from commit f931fd1)
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants