We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The error message is generic and therefore not very useful/actionable for the user who encounters it. In setattrbehavior.cpp
setattrbehavior.cpp
int constant_handler( Member* member, CAtom* atom, PyObject* value ) { cppy::type_error( "cannot set the value of a constant member" ); return -1; }
could be replaced with something like
int constant_handler( Member* member, CAtom* atom, PyObject* value ) { const char* member_str = PyUnicode_AsUTF8(member->name); PyObject* object_repr = PyObject_Repr(value); const PyObject object_base = atom->ob_base; const PyTypeObject* object_type = object_base.ob_type; char error_msg[500]; if((object_repr == NULL) || (object_type == NULL)) { snprintf(error_msg, 500, "cannot set the value of a constant member %s", member_str); cppy::type_error(error_msg); if(object_repr != NULL) { Py_DECREF(object_repr); } return -1; } const char* value_str = PyUnicode_AsUTF8(object_repr); const char* type_str = object_type->tp_name; snprintf(error_msg, 500, "cannot set the value %s of a constant member %s of an instance of %s", value_str, member_str, type_str); cppy::type_error(error_msg); Py_DECREF(object_repr); return -1; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The error message is generic and therefore not very useful/actionable for the user who encounters it.
In
setattrbehavior.cpp
could be replaced with something like
The text was updated successfully, but these errors were encountered: