mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-20 06:49:25 +00:00
fix: use original dict (#5658)
* fix: use original dict Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * refactor: handle unset dict just in case Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
@@ -35,10 +35,7 @@ void wrap(py::module m) {
|
||||
.def_readwrite("num", &SimpleBase::num)
|
||||
.def(py::pickle(
|
||||
[](const py::object &self) {
|
||||
py::dict d;
|
||||
if (py::hasattr(self, "__dict__")) {
|
||||
d = self.attr("__dict__");
|
||||
}
|
||||
py::dict d = py::getattr(self, "__dict__", py::dict());
|
||||
return py::make_tuple(self.attr("num"), d);
|
||||
},
|
||||
[](const py::tuple &t) {
|
||||
|
||||
Reference in New Issue
Block a user