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-21983: Fix a crash in ctypes.cast() in case the type argument is a ctypes structured data type. #3859

Merged
merged 1 commit into from
May 9, 2018

Conversation

orenmn
Copy link
Contributor

@orenmn orenmn commented Oct 2, 2017

In addition, add tests to test_ctypes to make sure that cast() raises a TypeError in case of a bad type argument (and doesn't crash).

https://bugs.python.org/issue21983

array = array_type()
self.assertRaises(TypeError, cast, array, None)
self.assertRaises(TypeError, cast, array, array_type)
class Struct(Structure):
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if cpython does this, but linking to the bug number in the test might be nice.

Copy link
Contributor

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

Fix looks obviously correct to me, and I can verify the test fails without it.

@miss-islington
Copy link
Contributor

Thanks @orenmn for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @orenmn for the PR, and @zooba for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 9, 2018
…ed data type (pythonGH-3859)

(cherry picked from commit d518d8b)

Co-authored-by: Oren Milman <orenmn@gmail.com>
@bedevere-bot
Copy link

GH-6745 is a backport of this pull request to the 3.7 branch.

@miss-islington
Copy link
Contributor

Sorry, @orenmn and @zooba, I could not cleanly backport this to 2.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker d518d8bc8d5dac1a1270612f424d33e0e5afc2b5 2.7

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 9, 2018
…ed data type (pythonGH-3859)

(cherry picked from commit d518d8b)

Co-authored-by: Oren Milman <orenmn@gmail.com>
@bedevere-bot
Copy link

GH-6746 is a backport of this pull request to the 3.6 branch.

@eric-wieser
Copy link
Contributor

@orenmn: Any change you could take a look at #5576, since you've already been looking over ctypes?

miss-islington added a commit that referenced this pull request May 9, 2018
…ed data type (GH-3859)

(cherry picked from commit d518d8b)

Co-authored-by: Oren Milman <orenmn@gmail.com>
@orenmn
Copy link
Contributor Author

orenmn commented May 10, 2018

sorry Eric, but i am too busy nowadays...

miss-islington added a commit that referenced this pull request May 26, 2018
…ed data type (GH-3859)

(cherry picked from commit d518d8b)

Co-authored-by: Oren Milman <orenmn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants