Skip to content

Commit

Permalink
TypeTreeHelper.cpp - fix __node__ value assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
K0lb3 authored Oct 28, 2024
1 parent 12fc9d4 commit c2805e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions UnityPyBoost/TypeTreeHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ inline PyObject *parse_class(PyObject *kwargs, TypeTreeNodeObject *node, TypeTre
PyErr_SetString(PyExc_ValueError, "Failed to get UnknownObject class");
goto PARSE_CLASS_CLEANUP;
}
PyDict_SetItemString(kwargs, "__node__", node->m_Type);
PyDict_SetItemString(kwargs, "__node__", (PyObject *) node);
}
}

Expand Down Expand Up @@ -542,7 +542,7 @@ inline PyObject *parse_class(PyObject *kwargs, TypeTreeNodeObject *node, TypeTre
{
Py_DECREF(clz); // 1->0
clz = PyObject_GetAttrString(config->classes, "UnknownObject"); // 0->1
PyDict_SetItemString(kwargs, "__node__", node->m_Type);
PyDict_SetItemString(kwargs, "__node__", (PyObject *) node);
}

instance = PyObject_Call(clz, args, kwargs);
Expand All @@ -560,7 +560,7 @@ inline PyObject *parse_class(PyObject *kwargs, TypeTreeNodeObject *node, TypeTre
// if we still failed to create an instance, fallback to UnknownObject
Py_DECREF(clz);
clz = PyObject_GetAttrString(config->classes, "UnknownObject");
PyDict_SetItemString(kwargs, "__node__", node->m_Type);
PyDict_SetItemString(kwargs, "__node__", (PyObject *) node);
// merge extras back into kwargs
pos = 0;
while (PyDict_Next(extras, &pos, &key, &value))
Expand Down

0 comments on commit c2805e3

Please sign in to comment.