Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
32d11c96
"tests/pybind11_tests.cpp" did not exist on "eda978e003263fd7a162716d3447bb4aba92332e"
Unverified
Commit
32d11c96
authored
Nov 16, 2020
by
Bjorn
Committed by
GitHub
Nov 16, 2020
Browse files
fix typo in pickle example (#2669)
parent
de78bddd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
docs/upgrade.rst
docs/upgrade.rst
+1
-1
No files found.
docs/upgrade.rst
View file @
32d11c96
...
@@ -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(
sel
f.value1(),
sel
f.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>(), ...);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment