-
Notifications
You must be signed in to change notification settings - Fork 26
Enable using cppyy with debug build of Python #56
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -1803,6 +1803,7 @@ bool CPyCppyy::Pythonize(PyObject* pyclass, const std::string& name) | |||
|
|
||||
| // data with size | ||||
| Utility::AddToClass(pyclass, "__real_data", "data"); | ||||
| PyErr_Clear(); // AddToClass might have failed for data | ||||
|
Comment on lines
1805
to
+1806
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This failure is at Line 224 in 221e52b
With pyclass and "data" as arguments.I guess this is one of the errors that we should not clear/ignore. I will look into it. |
||||
| Utility::AddToClass(pyclass, "data", (PyCFunction)VectorData); | ||||
|
|
||||
| // numpy array conversion | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -552,9 +552,9 @@ static bool AddTypeName(std::string& tmpl_name, PyObject* tn, PyObject* arg, | |
| PyErr_Clear(); | ||
|
|
||
| // ctypes function pointer | ||
| PyObject* argtypes = PyObject_GetAttrString(arg, "argtypes"); | ||
| PyObject* ret = PyObject_GetAttrString(arg, "restype"); | ||
| if (argtypes && ret) { | ||
| PyObject* argtypes = nullptr; | ||
| PyObject* ret = nullptr; | ||
| if ((argtypes = PyObject_GetAttrString(arg, "argtypes")) && (ret = PyObject_GetAttrString(arg, "restype"))) { | ||
|
Comment on lines
+555
to
+557
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just a safer rewrite for the |
||
| std::ostringstream tpn; | ||
| PyObject* pytc = PyObject_GetAttr(ret, PyStrings::gCTypesType); | ||
| tpn << CT2CppNameS(pytc, false) | ||
|
|
@@ -895,6 +895,7 @@ Py_ssize_t CPyCppyy::Utility::GetBuffer(PyObject* pyobject, char tc, int size, v | |
| if (PyObject_CheckBuffer(pyobject)) { | ||
| if (PySequence_Check(pyobject) && !PySequence_Size(pyobject)) | ||
| return 0; // PyObject_GetBuffer() crashes on some platforms for some zero-sized seqeunces | ||
| PyErr_Clear(); | ||
|
Comment on lines
896
to
+898
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This happens when |
||
|
|
||
| Py_buffer bufinfo; | ||
| memset(&bufinfo, 0, sizeof(Py_buffer)); | ||
|
|
||
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.
This happens when
meta_getattrofails. In my investigation, it failed for some special methods. And if the user does something like: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.
Hmm, now that I think about this, in the above-mentioned cases, it should not be calling
meta_getattro. I will need to cross-check this.