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
20ee9352
Commit
20ee9352
authored
May 28, 2016
by
Boris Schäling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use decltype to deduce return type of PyThread_create_key
parent
89656445
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
6 deletions
+6
-6
CMakeLists.txt
+1
-1
example/example10.cpp
+1
-1
example/example4.cpp
+1
-1
include/pybind11/common.h
+1
-1
include/pybind11/pybind11.h
+2
-2
No files found.
CMakeLists.txt
View file @
20ee9352
...
@@ -81,7 +81,7 @@ if(MSVC)
...
@@ -81,7 +81,7 @@ if(MSVC)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/W4"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/W4"
)
endif
()
endif
()
elseif
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
MATCHES
"Clang"
OR
"
${
CMAKE_CXX_COMPILER_ID
}
"
MATCHES
"GNU"
)
elseif
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
MATCHES
"Clang"
OR
"
${
CMAKE_CXX_COMPILER_ID
}
"
MATCHES
"GNU"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall -Wextra"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall -Wextra
-Wconversion
"
)
endif
()
endif
()
...
...
example/example10.cpp
View file @
20ee9352
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
double
my_func
(
int
x
,
float
y
,
double
z
)
{
double
my_func
(
int
x
,
float
y
,
double
z
)
{
std
::
cout
<<
"my_func(x:int="
<<
x
<<
", y:float="
<<
y
<<
", z:float="
<<
z
<<
")"
<<
std
::
endl
;
std
::
cout
<<
"my_func(x:int="
<<
x
<<
", y:float="
<<
y
<<
", z:float="
<<
z
<<
")"
<<
std
::
endl
;
return
x
*
y
*
z
;
return
(
float
)
x
*
y
*
z
;
}
}
std
::
complex
<
double
>
my_func3
(
std
::
complex
<
double
>
c
)
{
std
::
complex
<
double
>
my_func3
(
std
::
complex
<
double
>
c
)
{
...
...
example/example4.cpp
View file @
20ee9352
...
@@ -38,7 +38,7 @@ void test_function2(EMyEnumeration k) {
...
@@ -38,7 +38,7 @@ void test_function2(EMyEnumeration k) {
float
test_function3
(
int
i
)
{
float
test_function3
(
int
i
)
{
std
::
cout
<<
"test_function("
<<
i
<<
")"
<<
std
::
endl
;
std
::
cout
<<
"test_function("
<<
i
<<
")"
<<
std
::
endl
;
return
i
/
2.
f
;
return
(
float
)
i
/
2.
f
;
}
}
py
::
bytes
return_bytes
()
{
py
::
bytes
return_bytes
()
{
...
...
include/pybind11/common.h
View file @
20ee9352
...
@@ -262,7 +262,7 @@ struct internals {
...
@@ -262,7 +262,7 @@ struct internals {
std
::
unordered_map
<
const
void
*
,
void
*>
registered_instances
;
// void * -> PyObject*
std
::
unordered_map
<
const
void
*
,
void
*>
registered_instances
;
// void * -> PyObject*
std
::
unordered_set
<
std
::
pair
<
const
PyObject
*
,
const
char
*>
,
overload_hash
>
inactive_overload_cache
;
std
::
unordered_set
<
std
::
pair
<
const
PyObject
*
,
const
char
*>
,
overload_hash
>
inactive_overload_cache
;
#if defined(WITH_THREAD)
#if defined(WITH_THREAD)
long
tstate
=
0
;
decltype
(
PyThread_create_key
())
tstate
=
0
;
// Usually an int but a long on Cygwin64 with Python 3.x
PyInterpreterState
*
istate
=
nullptr
;
PyInterpreterState
*
istate
=
nullptr
;
#endif
#endif
};
};
...
...
include/pybind11/pybind11.h
View file @
20ee9352
...
@@ -1115,7 +1115,7 @@ public:
...
@@ -1115,7 +1115,7 @@ public:
gil_scoped_release
(
bool
disassoc
=
false
)
:
disassoc
(
disassoc
)
{
gil_scoped_release
(
bool
disassoc
=
false
)
:
disassoc
(
disassoc
)
{
tstate
=
PyEval_SaveThread
();
tstate
=
PyEval_SaveThread
();
if
(
disassoc
)
{
if
(
disassoc
)
{
int
key
=
detail
::
get_internals
().
tstate
;
auto
key
=
detail
::
get_internals
().
tstate
;
#if PY_MAJOR_VERSION < 3
#if PY_MAJOR_VERSION < 3
PyThread_delete_key_value
(
key
);
PyThread_delete_key_value
(
key
);
#else
#else
...
@@ -1128,7 +1128,7 @@ public:
...
@@ -1128,7 +1128,7 @@ public:
return
;
return
;
PyEval_RestoreThread
(
tstate
);
PyEval_RestoreThread
(
tstate
);
if
(
disassoc
)
{
if
(
disassoc
)
{
int
key
=
detail
::
get_internals
().
tstate
;
auto
key
=
detail
::
get_internals
().
tstate
;
#if PY_MAJOR_VERSION < 3
#if PY_MAJOR_VERSION < 3
PyThread_delete_key_value
(
key
);
PyThread_delete_key_value
(
key
);
#endif
#endif
...
...
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