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
gh-94731: Revert to C-style casts for _Py_CAST #94782
Conversation
Co-Authored-By: da-woods <dw-git@d-woods.co.uk>
We have buildbots like that...
Lib/test/_testcppext.cpp
Outdated
| PyObject *ipotype = PyType_FromSpec(&VirtualPyObject_Spec); | ||
| // no good way to signal failure from a C++ constructor, so use assert | ||
| // for error handling | ||
| assert(ipotype); | ||
| assert(PyObject_Init(this, (PyTypeObject *)ipotype)); | ||
| Py_DECREF(ipotype); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| PyObject *ipotype = PyType_FromSpec(&VirtualPyObject_Spec); | |
| // no good way to signal failure from a C++ constructor, so use assert | |
| // for error handling | |
| assert(ipotype); | |
| assert(PyObject_Init(this, (PyTypeObject *)ipotype)); | |
| Py_DECREF(ipotype); | |
| PyObject *vpotype = PyType_FromSpec(&VirtualPyObject_Spec); | |
| // no good way to signal failure from a C++ constructor, so use assert | |
| // for error handling | |
| assert(vpotype); | |
| assert(PyObject_Init(this, (PyTypeObject *)vpotype)); | |
| Py_DECREF(vpotype); |
Just suggesting changing the name slightly here to match the name you used from the class. I think the i from ipotype was a hold-over from the name I used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! It's a local variable now so I'll just name it type :)
|
Thanks @encukou for the PR |
Co-authored-by: da-woods <dw-git@d-woods.co.uk> (cherry picked from commit 6cbb57f) Co-authored-by: Petr Viktorin <encukou@gmail.com>
|
GH-94849 is a backport of this pull request to the 3.11 branch. |


This reverts some changes from #91321