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
ad966556
Unverified
Commit
ad966556
authored
Oct 03, 2021
by
Aaron Gokaslan
Committed by
GitHub
Oct 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: replace free() with std::free() (#3321)
* Disambiguate free() to use std::free() * Add cstdlib include
parent
b3573ac9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
include/pybind11/pybind11.h
+3
-2
tests/test_embed/test_interpreter.cpp
+2
-1
No files found.
include/pybind11/pybind11.h
View file @
ad966556
...
...
@@ -16,6 +16,7 @@
#include "detail/class.h"
#include "detail/init.h"
#include <cstdlib>
#include <memory>
#include <new>
#include <vector>
...
...
@@ -1536,7 +1537,7 @@ public:
char
*
doc_prev
=
rec_fget
->
doc
;
/* 'extra' field may include a property-specific documentation string */
detail
::
process_attributes
<
Extra
...
>::
init
(
extra
...,
rec_fget
);
if
(
rec_fget
->
doc
&&
rec_fget
->
doc
!=
doc_prev
)
{
free
(
doc_prev
);
std
::
free
(
doc_prev
);
rec_fget
->
doc
=
PYBIND11_COMPAT_STRDUP
(
rec_fget
->
doc
);
}
}
...
...
@@ -1544,7 +1545,7 @@ public:
char
*
doc_prev
=
rec_fset
->
doc
;
detail
::
process_attributes
<
Extra
...
>::
init
(
extra
...,
rec_fset
);
if
(
rec_fset
->
doc
&&
rec_fset
->
doc
!=
doc_prev
)
{
free
(
doc_prev
);
std
::
free
(
doc_prev
);
rec_fset
->
doc
=
PYBIND11_COMPAT_STRDUP
(
rec_fset
->
doc
);
}
if
(
!
rec_active
)
rec_active
=
rec_fset
;
...
...
tests/test_embed/test_interpreter.cpp
View file @
ad966556
...
...
@@ -8,6 +8,7 @@
#include <catch.hpp>
#include <cstdlib>
#include <fstream>
#include <functional>
#include <thread>
...
...
@@ -315,7 +316,7 @@ TEST_CASE("sys.argv gets initialized properly") {
{
char
*
argv
[]
=
{
strdup
(
"a.out"
)};
py
::
scoped_interpreter
argv_scope
(
true
,
1
,
argv
);
free
(
argv
[
0
]);
std
::
free
(
argv
[
0
]);
auto
module
=
py
::
module
::
import
(
"test_interpreter"
);
auto
py_widget
=
module
.
attr
(
"DerivedWidget"
)(
"The question"
);
const
auto
&
cpp_widget
=
py_widget
.
cast
<
const
Widget
&>
();
...
...
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