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
961b2e62
Unverified
Commit
961b2e62
authored
Oct 02, 2020
by
Hyrum Wright
Committed by
GitHub
Oct 02, 2020
Browse files
fix: ensure the GIL is held when copying a function. (#2545)
Co-authored-by:
Hyrum Wright
<
hwright@google.com
>
parent
1bcd5f0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
include/pybind11/functional.h
include/pybind11/functional.h
+4
-1
No files found.
include/pybind11/functional.h
View file @
961b2e62
...
@@ -58,7 +58,10 @@ public:
...
@@ -58,7 +58,10 @@ public:
struct
func_handle
{
struct
func_handle
{
function
f
;
function
f
;
func_handle
(
function
&&
f_
)
:
f
(
std
::
move
(
f_
))
{}
func_handle
(
function
&&
f_
)
:
f
(
std
::
move
(
f_
))
{}
func_handle
(
const
func_handle
&
)
=
default
;
func_handle
(
const
func_handle
&
f_
)
{
gil_scoped_acquire
acq
;
f
=
f_
.
f
;
}
~
func_handle
()
{
~
func_handle
()
{
gil_scoped_acquire
acq
;
gil_scoped_acquire
acq
;
function
kill_f
(
std
::
move
(
f
));
function
kill_f
(
std
::
move
(
f
));
...
...
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