Skip to content

Commit aab6959

Browse files
committed
CI fixes
1 parent eab23fa commit aab6959

14 files changed

+25
-10
lines changed

include/pybind11/detail/common.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@
214214
# define PYBIND11_SIMPLE_GIL_MANAGEMENT
215215
#endif
216216

217+
#if defined(_MSC_VER)
218+
# define PYBIND11_COMPAT_STRDUP _strdup
219+
#else
220+
# define PYBIND11_COMPAT_STRDUP strdup
221+
#endif
222+
217223
#include <cstddef>
218224
#include <cstring>
219225
#include <exception>

include/pybind11/detail/foreign.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ PYBIND11_NOINLINE void export_type_to_foreign(type_info *ti) {
405405
binding->framework = foreign_internals.self.get();
406406
binding->pytype = ti->type;
407407
binding->native_type = ti->cpptype;
408-
binding->source_name = strdup(clean_type_id(ti->cpptype->name()).c_str());
408+
binding->source_name = PYBIND11_COMPAT_STRDUP(clean_type_id(ti->cpptype->name()).c_str());
409409
binding->context = ti;
410410

411411
capsule tie_lifetimes((void *) binding, [](void *p) {

include/pybind11/detail/type_caster_base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1717,7 +1717,7 @@ class type_caster_base : public type_caster_generic {
17171717
handle ret, std::shared_ptr<const void> holder, pymb_framework *framework) {
17181718
// Make the resulting Python object keep a shared_ptr<T> alive,
17191719
// even if there's not space for it inside the object.
1720-
std::unique_ptr<std::shared_ptr<const void>> sp{new auto{std::move(holder)}};
1720+
std::unique_ptr<std::shared_ptr<const void>> sp{new auto(std::move(holder))};
17211721
if (-1 == framework->keep_alive(ret.ptr(), sp.get(), [](void *p) noexcept {
17221722
delete (std::shared_ptr<const void> *) p;
17231723
})) {

include/pybind11/pybind11.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ inline std::string generate_function_signature(const char *type_caster_name_fiel
161161
if (handle th = detail::get_type_handle(*t, false, true)) {
162162
signature += th.attr("__module__").cast<std::string>() + "."
163163
+ th.attr("__qualname__").cast<std::string>();
164-
} else if (auto th = detail::global_internals_native_enum_type_map_get_item(*t)) {
164+
} else if ((th = detail::global_internals_native_enum_type_map_get_item(*t))) {
165165
signature += th.attr("__module__").cast<std::string>() + "."
166166
+ th.attr("__qualname__").cast<std::string>();
167167
} else if (func_rec->is_new_style_constructor && arg_index == 0) {
@@ -242,12 +242,6 @@ inline std::string generate_type_signature() {
242242
caster_name_field.text, &func_rec, descr_types.data(), type_index, arg_index);
243243
}
244244

245-
#if defined(_MSC_VER)
246-
# define PYBIND11_COMPAT_STRDUP _strdup
247-
#else
248-
# define PYBIND11_COMPAT_STRDUP strdup
249-
#endif
250-
251245
PYBIND11_NAMESPACE_END(detail)
252246

253247
/// Wraps an arbitrary C++ function/method/lambda function/.. into a callable Python object

tests/test_buffers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ TEST_SUBMODULE(buffers, m) {
227227
+ std::to_string(cols) + "(*" + std::to_string(col_factor)
228228
+ ") matrix");
229229
}
230-
230+
DiscontiguousMatrix(const DiscontiguousMatrix&) = delete;
231231
~DiscontiguousMatrix() {
232232
print_destroyed(this,
233233
std::to_string(rows() / m_row_factor) + "(*"

tests/test_class.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ TEST_SUBMODULE(class_, m) {
521521
// test_exception_rvalue_abort
522522
struct PyPrintDestructor {
523523
PyPrintDestructor() = default;
524+
PyPrintDestructor(const PyPrintDestructor&) = default;
524525
~PyPrintDestructor() { py::print("Print from destructor"); }
525526
void throw_something() { throw std::runtime_error("error"); }
526527
};

tests/test_class_release_gil_before_calling_cpp_dtor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct ProbeType {
2222

2323
public:
2424
explicit ProbeType(const std::string &unique_key) : unique_key{unique_key} {}
25+
ProbeType(const ProbeType&) = default;
2526

2627
~ProbeType() {
2728
RegistryType &reg = PyGILState_Check_Results();

tests/test_cross_module_rtti/lib.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ __pragma(warning(disable : 4251))
1212
class TEST_CROSS_MODULE_RTTI_LIB_EXPORT Base : public std::enable_shared_from_this<Base> {
1313
public:
1414
Base(int a, int b);
15+
Base(const Base&) = default;
1516
virtual ~Base() = default;
1617

1718
virtual int get() const;

tests/test_eigen_matrix.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ TEST_SUBMODULE(eigen_matrix, m) {
237237

238238
public:
239239
ReturnTester() { print_created(this); }
240+
ReturnTester(const ReturnTester&) = default;
240241
~ReturnTester() { print_destroyed(this); }
241242
static Eigen::MatrixXd create() { return Eigen::MatrixXd::Ones(10, 10); }
242243
// NOLINTNEXTLINE(readability-const-return-type)

tests/test_numpy_array.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ TEST_SUBMODULE(numpy_array, sm) {
282282
struct ArrayClass {
283283
int data[2] = {1, 2};
284284
ArrayClass() { py::print("ArrayClass()"); }
285+
ArrayClass(const ArrayClass&) = default;
285286
~ArrayClass() { py::print("~ArrayClass()"); }
286287
};
287288
py::class_<ArrayClass>(sm, "ArrayClass")

0 commit comments

Comments
 (0)