Skip to content

Commit acfba60

Browse files
committed
3.7 api fixes
1 parent f00076a commit acfba60

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

UnityPyBoost/TypeTreeHelper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,20 +462,20 @@ PyObject *read_typetree(PyObject *self, PyObject *args, PyObject *kwargs)
462462
return NULL;
463463
}
464464

465-
config.as_dict = Py_IsTrue(as_dict) == 1;
465+
config.as_dict = as_dict == Py_True;
466466
if (!config.as_dict)
467467
{
468468
if (PyCallable_Check(config.clean_name) == 0)
469469
{
470470
PyErr_SetString(PyExc_ValueError, "clean_name must be callable if not as dict");
471471
return NULL;
472472
}
473-
if (Py_IsNone(config.assetfile) == 1)
473+
if (config.assetfile == Py_None)
474474
{
475475
PyErr_SetString(PyExc_ValueError, "assetsfile must be set if not as dict");
476476
return NULL;
477477
}
478-
if (Py_IsNone(config.classes) == 1)
478+
if (config.classes == Py_None)
479479
{
480480
PyErr_SetString(PyExc_ValueError, "classes must be set if not as dict");
481481
return NULL;

tests/test_main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def test_save_dict():
2626
for obj in env.objects:
2727
data = obj.get_raw_data()
2828
item = obj.read_typetree(wrap=False)
29+
assert isinstance(item, dict)
2930
re_data = obj.save_typetree(item)
3031
assert data == re_data
3132

@@ -35,6 +36,7 @@ def test_save_wrap():
3536
for obj in env.objects:
3637
data = obj.get_raw_data()
3738
item = obj.read_typetree(wrap=True)
39+
assert not isinstance(item, dict)
3840
re_data = obj.save_typetree(item)
3941
assert data == re_data
4042

0 commit comments

Comments
 (0)