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
c8e9f3cc
Commit
c8e9f3cc
authored
Sep 14, 2018
by
Wenzel Jakob
Browse files
quench __setstate__ warnings (fixes #1522)
parent
ef13fb2e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
include/pybind11/pybind11.h
include/pybind11/pybind11.h
+9
-4
No files found.
include/pybind11/pybind11.h
View file @
c8e9f3cc
...
...
@@ -1503,9 +1503,11 @@ NAMESPACE_END(detail)
/// Binds C++ enumerations and enumeration classes to Python
template
<
typename
Type
>
class
enum_
:
public
class_
<
Type
>
{
public:
using
class_
<
Type
>::
def
;
using
class_
<
Type
>::
def_property_readonly
;
using
class_
<
Type
>::
def_property_readonly_static
;
using
Base
=
class_
<
Type
>
;
using
Base
::
def
;
using
Base
::
attr
;
using
Base
::
def_property_readonly
;
using
Base
::
def_property_readonly_static
;
using
Scalar
=
typename
std
::
underlying_type
<
Type
>::
type
;
template
<
typename
...
Extra
>
...
...
@@ -1520,7 +1522,10 @@ public:
#if PY_MAJOR_VERSION < 3
def
(
"__long__"
,
[](
Type
value
)
{
return
(
Scalar
)
value
;
});
#endif
def
(
"__setstate__"
,
[](
Type
&
value
,
Scalar
arg
)
{
value
=
static_cast
<
Type
>
(
arg
);
});
cpp_function
setstate
(
[](
Type
&
value
,
Scalar
arg
)
{
value
=
static_cast
<
Type
>
(
arg
);
},
is_method
(
*
this
));
attr
(
"__setstate__"
)
=
setstate
;
}
/// Export enumeration entries into the parent scope
...
...
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