Skip to content

Commit 9ae35d2

Browse files
committed
Add more PYBIND11_NS_VISIBILITY to resolve CUDA and mingw warnings.
1 parent f963a08 commit 9ae35d2

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

tests/pybind11_cross_module_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ PYBIND11_MODULE(pybind11_cross_module_tests, m) {
4848
if (p) {
4949
std::rethrow_exception(p);
5050
}
51-
} catch (const shared_exception &e) {
51+
} catch (const pybind11_tests::shared_exception &e) {
5252
PyErr_SetString(PyExc_KeyError, e.what());
5353
}
5454
});

tests/test_custom_type_setup.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,19 @@
1313

1414
namespace py = pybind11;
1515

16+
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NS_VISIBILITY(pybind11_tests))
1617
namespace {
1718

1819
struct OwnsPythonObjects {
1920
py::object value = py::none();
2021
};
22+
2123
} // namespace
24+
PYBIND11_NAMESPACE_END(pybind11_tests)
2225

2326
TEST_SUBMODULE(custom_type_setup, m) {
27+
using namespace pybind11_tests;
28+
2429
py::class_<OwnsPythonObjects> cls(
2530
m, "OwnsPythonObjects", py::custom_type_setup([](PyHeapTypeObject *heap_type) {
2631
auto *type = &heap_type->ht_type;

tests/test_exceptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@
55

66
// shared exceptions for cross_module_tests
77

8+
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NS_VISIBILITY(pybind11_tests))
9+
810
class PYBIND11_EXPORT_EXCEPTION shared_exception : public pybind11::builtin_exception {
911
public:
1012
using builtin_exception::builtin_exception;
1113
explicit shared_exception() : shared_exception("") {}
1214
void set_error() const override { PyErr_SetString(PyExc_RuntimeError, what()); }
1315
};
16+
17+
PYBIND11_NAMESPACE_END(pybind11_tests)

0 commit comments

Comments
 (0)