Commit 32d11c96 by Bjorn Committed by GitHub

fix typo in pickle example (#2669)

parent de78bddd
...@@ -192,7 +192,7 @@ way to get and set object state. See :ref:`pickling` for details. ...@@ -192,7 +192,7 @@ way to get and set object state. See :ref:`pickling` for details.
... ...
.def(py::pickle( .def(py::pickle(
[](const Foo &self) { // __getstate__ [](const Foo &self) { // __getstate__
return py::make_tuple(f.value1(), f.value2(), ...); // unchanged return py::make_tuple(self.value1(), self.value2(), ...); // unchanged
}, },
[](py::tuple t) { // __setstate__, note: no `self` argument [](py::tuple t) { // __setstate__, note: no `self` argument
return new Foo(t[0].cast<std::string>(), ...); return new Foo(t[0].cast<std::string>(), ...);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment