Skip to content

Conversation

@Vipul-Cariappa
Copy link
Collaborator

No description provided.

@Vipul-Cariappa Vipul-Cariappa marked this pull request as draft October 28, 2024 09:54
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);
Copy link
Collaborator Author

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.

Comment on lines 530 to +535
// 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
Copy link
Collaborator Author

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.

@Vipul-Cariappa Vipul-Cariappa marked this pull request as ready for review October 29, 2024 07:03
Copy link

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

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

LGTM!

@Vipul-Cariappa
Copy link
Collaborator Author

Running the 3 failing tests separately, they pass.
i.e.
pytest -sv Fails.
But pytest -v test_stltypes.py::TestSTLEXCEPTION::test01_basics, pytest -v test_stltypes.py::TestSTLARRAY::test02_array_of_pods & pytest -v test_regression.py::TestREGRESSION::test09_gil_not_released Passes.
Because of this behavior, I suspect the failures are due to some side effect of other xfail tests.

As a temporary workaround, can we wrap the & and & around a macro for cling and CppInterOp?


ping @aaronj0

Vipul-Cariappa added a commit to Vipul-Cariappa/cppyy-compiler-research that referenced this pull request Nov 8, 2024
changes to make sure `dm_set` is called when assigning a value to an enum resulting in raising TypeError
@aaronj0 aaronj0 merged commit 529f920 into compiler-research:master Nov 15, 2024
10 of 15 checks passed
@Vipul-Cariappa Vipul-Cariappa deleted the bug-fix branch November 15, 2024 14:47
Vipul-Cariappa added a commit to Vipul-Cariappa/cppyy-compiler-research that referenced this pull request Nov 16, 2024
Vipul-Cariappa added a commit to Vipul-Cariappa/cppyy-compiler-research that referenced this pull request Nov 16, 2024
Vipul-Cariappa added a commit to Vipul-Cariappa/cppyy-compiler-research that referenced this pull request Nov 16, 2024
Vipul-Cariappa added a commit to Vipul-Cariappa/cppyy-compiler-research that referenced this pull request Nov 16, 2024
Vipul-Cariappa added a commit to Vipul-Cariappa/cppyy-compiler-research that referenced this pull request Nov 16, 2024
vgvassilev pushed a commit to compiler-research/cppyy that referenced this pull request Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants