Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
00b8f365
Commit
00b8f365
authored
Sep 04, 2017
by
Dean Moldovan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Relax py::pickle() get/set type check
Fixes #1061. `T` and `const T &` are compatible types.
parent
7939f4b3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
2 deletions
+5
-2
docs/changelog.rst
+3
-0
include/pybind11/detail/init.h
+1
-1
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)
...
@@ -17,6 +17,9 @@ v2.2.1 (Not yet released)
* Fixed a regression where the ``py::keep_alive`` policy could not be applied
* Fixed a regression where the ``py::keep_alive`` policy could not be applied
to constructors. `#1065 <https://github.com/pybind/pybind11/pull/1065>`_.
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)
v2.2.0 (August 31, 2017)
-----------------------------------------------------
-----------------------------------------------------
...
...
include/pybind11/detail/init.h
View file @
00b8f365
...
@@ -293,7 +293,7 @@ struct pickle_factory;
...
@@ -293,7 +293,7 @@ struct pickle_factory;
template
<
typename
Get
,
typename
Set
,
template
<
typename
Get
,
typename
Set
,
typename
RetState
,
typename
Self
,
typename
NewInstance
,
typename
ArgState
>
typename
RetState
,
typename
Self
,
typename
NewInstance
,
typename
ArgState
>
struct
pickle_factory
<
Get
,
Set
,
RetState
(
Self
),
NewInstance
(
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 "
"The type returned by `__getstate__` must be the same "
"as the argument accepted by `__setstate__`"
);
"as the argument accepted by `__setstate__`"
);
...
...
tests/test_pickling.cpp
View file @
00b8f365
...
@@ -115,7 +115,7 @@ TEST_SUBMODULE(pickling, m) {
...
@@ -115,7 +115,7 @@ TEST_SUBMODULE(pickling, m) {
[](
py
::
object
self
)
{
[](
py
::
object
self
)
{
return
py
::
make_tuple
(
self
.
attr
(
"value"
),
self
.
attr
(
"extra"
),
self
.
attr
(
"__dict__"
));
return
py
::
make_tuple
(
self
.
attr
(
"value"
),
self
.
attr
(
"extra"
),
self
.
attr
(
"__dict__"
));
},
},
[](
py
::
tuple
t
)
{
[](
const
py
::
tuple
&
t
)
{
if
(
t
.
size
()
!=
3
)
if
(
t
.
size
()
!=
3
)
throw
std
::
runtime_error
(
"Invalid state!"
);
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