[App] PropertyPythonObject Python 3.11 fix

This commit is contained in:
Syres916
2023-09-05 09:04:35 +01:00
committed by GitHub
parent a849f752bc
commit 8d9fc1bce2

View File

@@ -87,6 +87,7 @@ std::string PropertyPythonObject::toString() const
throw Py::Exception();
Py::Callable method(pickle.getAttr(std::string("dumps")));
Py::Object dump;
#if PY_VERSION_HEX < 0x03b0000
if (this->object.hasAttr("__getstate__")) {
Py::Tuple args;
Py::Callable state(this->object.getAttr("__getstate__"));
@@ -98,6 +99,9 @@ std::string PropertyPythonObject::toString() const
else {
dump = this->object;
}
#else
dump = this->object;
#endif
Py::Tuple args(1);
args.setItem(0, dump);