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
00b8f365
Commit
00b8f365
authored
Sep 04, 2017
by
Dean Moldovan
Browse files
Relax py::pickle() get/set type check
Fixes #1061. `T` and `const T &` are compatible types.
parent
7939f4b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
2 deletions
+5
-2
docs/changelog.rst
docs/changelog.rst
+3
-0
include/pybind11/detail/init.h
include/pybind11/detail/init.h
+1
-1
tests/test_pickling.cpp
tests/test_pickling.cpp
+1
-1
No files found.
docs/changelog.rst
View file @
00b8f365
...
...
@@ -17,6 +17,9 @@ v2.2.1 (Not yet released)
* Fixed a regression where the ``py::keep_alive`` policy could not be applied
to constructors. `#1065 <https://github.com/pybind/pybind11/pull/1065>`_.
* Relax overly strict ``py::picke()`` check for matching get and set types.
`#1064 <https://github.com/pybind/pybind11/pull/1064>`_.
v2.2.0 (August 31, 2017)
-----------------------------------------------------
...
...
include/pybind11/detail/init.h
View file @
00b8f365
...
...
@@ -293,7 +293,7 @@ struct pickle_factory;
template
<
typename
Get
,
typename
Set
,
typename
RetState
,
typename
Self
,
typename
NewInstance
,
typename
ArgState
>
struct
pickle_factory
<
Get
,
Set
,
RetState
(
Self
),
NewInstance
(
ArgState
)
>
{
static_assert
(
std
::
is_same
<
RetState
,
ArgState
>::
value
,
static_assert
(
std
::
is_same
<
intrinsic_t
<
RetState
>
,
intrinsic_t
<
ArgState
>
>
::
value
,
"The type returned by `__getstate__` must be the same "
"as the argument accepted by `__setstate__`"
);
...
...
tests/test_pickling.cpp
View file @
00b8f365
...
...
@@ -115,7 +115,7 @@ TEST_SUBMODULE(pickling, m) {
[](
py
::
object
self
)
{
return
py
::
make_tuple
(
self
.
attr
(
"value"
),
self
.
attr
(
"extra"
),
self
.
attr
(
"__dict__"
));
},
[](
py
::
tuple
t
)
{
[](
const
py
::
tuple
&
t
)
{
if
(
t
.
size
()
!=
3
)
throw
std
::
runtime_error
(
"Invalid state!"
);
...
...
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