fix typo in pickle example (#2669)

This commit is contained in:
Bjorn 2020-11-16 15:57:06 +01:00 committed by GitHub
parent de78bddd7f
commit 32d11c9653
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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>(), ...);