Skip to content

[3.8] bpo-41654: Explicitly cast PyExc_MemoryError to PyTypeObject to avoid warning #22102

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
Sep 5, 2020

Conversation

pablogsal
Copy link
Member

@pablogsal pablogsal commented Sep 4, 2020

@pablogsal pablogsal requested a review from vstinner September 4, 2020 22:27
@pablogsal pablogsal changed the title bpo-41654: Explicitly cast PyExc_MemoryError to PyTypeObject to avoid warning [3.8] bpo-41654: Explicitly cast PyExc_MemoryError to PyTypeObject to avoid warning Sep 4, 2020
@@ -2295,7 +2295,7 @@ MemoryError_dealloc(PyBaseExceptionObject *self)
{
BaseException_clear(self);

if (Py_TYPE(self) != PyExc_MemoryError) {
if (Py_TYPE(self) != (PyTypeObject *)PyExc_MemoryError) {
return Py_TYPE(self)->tp_free((PyObject *)self);
Copy link
Member

Choose a reason for hiding this comment

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

I got another compile warning: D:\a\1\s\Objects\exceptions.c(2324,56): warning C4098: 'MemoryError_dealloc': 'void' function returning a value [D:\a\1\s\PCbuild\pythoncore.vcxproj] in here.
Maybe we can cancel return?

Copy link
Member Author

Choose a reason for hiding this comment

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

We cannot cancel it, but we can split the expression so the mvsc is happy.

Copy link
Member

@shihai1991 shihai1991 left a comment

Choose a reason for hiding this comment

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

Thanks for your update. LGTM now :)

@pablogsal pablogsal merged commit 6ae6195 into python:3.8 Sep 5, 2020
@pablogsal pablogsal deleted the bpo-41654 branch September 5, 2020 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants