mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
fix: replace free() with std::free() (#3321)
* Disambiguate free() to use std::free() * Add cstdlib include
This commit is contained in:
parent
b3573ac961
commit
ad96655605
@ -16,6 +16,7 @@
|
|||||||
#include "detail/class.h"
|
#include "detail/class.h"
|
||||||
#include "detail/init.h"
|
#include "detail/init.h"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -1536,7 +1537,7 @@ public:
|
|||||||
char *doc_prev = rec_fget->doc; /* 'extra' field may include a property-specific documentation string */
|
char *doc_prev = rec_fget->doc; /* 'extra' field may include a property-specific documentation string */
|
||||||
detail::process_attributes<Extra...>::init(extra..., rec_fget);
|
detail::process_attributes<Extra...>::init(extra..., rec_fget);
|
||||||
if (rec_fget->doc && rec_fget->doc != doc_prev) {
|
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);
|
rec_fget->doc = PYBIND11_COMPAT_STRDUP(rec_fget->doc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1544,7 +1545,7 @@ public:
|
|||||||
char *doc_prev = rec_fset->doc;
|
char *doc_prev = rec_fset->doc;
|
||||||
detail::process_attributes<Extra...>::init(extra..., rec_fset);
|
detail::process_attributes<Extra...>::init(extra..., rec_fset);
|
||||||
if (rec_fset->doc && rec_fset->doc != doc_prev) {
|
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);
|
rec_fset->doc = PYBIND11_COMPAT_STRDUP(rec_fset->doc);
|
||||||
}
|
}
|
||||||
if (! rec_active) rec_active = rec_fset;
|
if (! rec_active) rec_active = rec_fset;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <catch.hpp>
|
#include <catch.hpp>
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
@ -315,7 +316,7 @@ TEST_CASE("sys.argv gets initialized properly") {
|
|||||||
{
|
{
|
||||||
char *argv[] = {strdup("a.out")};
|
char *argv[] = {strdup("a.out")};
|
||||||
py::scoped_interpreter argv_scope(true, 1, argv);
|
py::scoped_interpreter argv_scope(true, 1, argv);
|
||||||
free(argv[0]);
|
std::free(argv[0]);
|
||||||
auto module = py::module::import("test_interpreter");
|
auto module = py::module::import("test_interpreter");
|
||||||
auto py_widget = module.attr("DerivedWidget")("The question");
|
auto py_widget = module.attr("DerivedWidget")("The question");
|
||||||
const auto &cpp_widget = py_widget.cast<const Widget &>();
|
const auto &cpp_widget = py_widget.cast<const Widget &>();
|
||||||
|
Loading…
Reference in New Issue
Block a user