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
c8e9f3cc
Commit
c8e9f3cc
authored
Sep 14, 2018
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quench __setstate__ warnings (fixes #1522)
parent
ef13fb2e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
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