-
Notifications
You must be signed in to change notification settings - Fork 5
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
fix type converters function resolution #65
Conversation
PyType_Type.tp_setattro(pyclass, pyname, attr); | ||
else | ||
PyType_Type.tp_setattro((PyObject*)Py_TYPE(pyclass), pyname, attr); | ||
PyType_Type.tp_setattro((PyObject*)Py_TYPE(pyclass), pyname, attr); |
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.
Doing the same as upstream.
// are needed to prevent unnecessary lookups and recursion. | ||
if (((CPPScope*)pyclass)->fFlags & CPPScope::kIsNamespace) { | ||
// skip if the given pyval is a descriptor already, or an unassignable class | ||
if (!CPyCppyy::CPPDataMember_Check(pyval) && !CPyCppyy::CPPScope_Check(pyval)) { | ||
std::string name = CPyCppyy_PyText_AsString(pyname); | ||
if (Cppyy::GetNamed(name, ((CPPScope*)pyclass)->fCppType)) | ||
meta_getattro(pyclass, pyname); // triggers creation | ||
} | ||
if (!CPyCppyy::CPPDataMember_Check(pyval) && !CPyCppyy::CPPScope_Check(pyval)) { | ||
std::string name = CPyCppyy_PyText_AsString(pyname); | ||
if (Cppyy::GetNamed(name, ((CPPScope*)pyclass)->fCppType)) | ||
meta_getattro(pyclass, pyname); // triggers creation |
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 makes sure that meta_getattro
is called. Later tp_setattro
calls dm_set
. Raising the TypeError. Otherwise tp_setattro
calls generic setattr.
ce0b710
to
0cba8db
Compare
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.
LGTM!
Running the 3 failing tests separately, they pass. As a temporary workaround, can we wrap the ping @aaronj0 |
0cba8db
to
afdff88
Compare
changes to make sure `dm_set` is called when assigning a value to an enum resulting in raising TypeError
8864627
to
025733e
Compare
No description provided.