Skip to content

bpo-36150: Fix possible assertion failures due to _ctypes.c's PyCData_reduce() #12106

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

Conversation

ZackerySpytz
Copy link
Contributor

@ZackerySpytz ZackerySpytz commented Feb 28, 2019

(This is a "skip news" PR.)

https://bugs.python.org/issue36150

@tiran
Copy link
Member

tiran commented Feb 28, 2019

The extra checks are not necessary. O and N handle NULL correctly.

@tiran tiran closed this Feb 28, 2019
if (dict == NULL) {
return NULL;
}
PyObject *bytes = PyBytes_FromStringAndSize(self->b_ptr, self->b_size);
Copy link
Member

Choose a reason for hiding this comment

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

It is enough to check for error only dict. PyBytes_FromStringAndSize() can be passed directly to Py_BuildValue().

Copy link
Member

Choose a reason for hiding this comment

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

You could even use y# instead of PyBytes_FromStringAndSize().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, Serhiy. I've updated the PR.

@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error needs backport to 3.7 skip news and removed invalid labels Mar 31, 2019
@serhiy-storchaka serhiy-storchaka merged commit 5f2c508 into python:master Mar 31, 2019
@miss-islington
Copy link
Contributor

Thanks @ZackerySpytz for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.7.
🐍🍒⛏🤖

@bedevere-bot
Copy link

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

@miss-islington
Copy link
Contributor

Sorry, @ZackerySpytz and @serhiy-storchaka, I could not cleanly backport this to 2.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 5f2c50810a67982b0c80f6d3258fee3647f67005 2.7

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 31, 2019
…_reduce(). (pythonGH-12106)

(cherry picked from commit 5f2c508)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
ZackerySpytz added a commit to ZackerySpytz/cpython that referenced this pull request Mar 31, 2019
@bedevere-bot
Copy link

GH-12643 is a backport of this pull request to the 2.7 branch.

serhiy-storchaka pushed a commit that referenced this pull request Mar 31, 2019
serhiy-storchaka pushed a commit that referenced this pull request Mar 31, 2019
…_reduce(). (GH-12106) (GH-12642)

(cherry picked from commit 5f2c508)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
@serhiy-storchaka serhiy-storchaka removed their assignment Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants