mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
fix typo in pickle example (#2669)
This commit is contained in:
parent
de78bddd7f
commit
32d11c9653
@ -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>(), ...);
|
||||||
|
Loading…
Reference in New Issue
Block a user