@@ -21,7 +21,7 @@ class ArgInspector2 {
21
21
};
22
22
class ArgAlwaysConverts {};
23
23
24
- namespace pybind11 {
24
+ namespace PYBIND11_NAMESPACE {
25
25
namespace detail {
26
26
template <>
27
27
struct type_caster <ArgInspector1> {
@@ -74,7 +74,7 @@ struct type_caster<ArgAlwaysConverts> {
74
74
}
75
75
};
76
76
} // namespace detail
77
- } // namespace pybind11
77
+ } // namespace PYBIND11_NAMESPACE
78
78
79
79
// test_custom_caster_destruction
80
80
class DestructionTester {
@@ -92,7 +92,7 @@ class DestructionTester {
92
92
return *this ;
93
93
}
94
94
};
95
- namespace pybind11 {
95
+ namespace PYBIND11_NAMESPACE {
96
96
namespace detail {
97
97
template <>
98
98
struct type_caster <DestructionTester> {
@@ -104,15 +104,15 @@ struct type_caster<DestructionTester> {
104
104
}
105
105
};
106
106
} // namespace detail
107
- } // namespace pybind11
107
+ } // namespace PYBIND11_NAMESPACE
108
108
109
109
// Define type caster outside of `pybind11::detail` and then alias it.
110
110
namespace other_lib {
111
111
struct MyType {};
112
112
// Corrupt `py` shorthand alias for surrounding context.
113
113
namespace py {}
114
114
// Corrupt unqualified relative `pybind11` namespace.
115
- namespace pybind11 {}
115
+ namespace PYBIND11_NAMESPACE {}
116
116
// Correct alias.
117
117
namespace py_ = ::pybind11;
118
118
// Define caster. This is effectively no-op, we only ensure it compiles and we
@@ -127,12 +127,12 @@ struct my_caster {
127
127
};
128
128
} // namespace other_lib
129
129
// Effectively "alias" it into correct namespace (via inheritance).
130
- namespace pybind11 {
130
+ namespace PYBIND11_NAMESPACE {
131
131
namespace detail {
132
132
template <>
133
133
struct type_caster <other_lib::MyType> : public other_lib::my_caster {};
134
134
} // namespace detail
135
- } // namespace pybind11
135
+ } // namespace PYBIND11_NAMESPACE
136
136
137
137
TEST_SUBMODULE (custom_type_casters, m) {
138
138
// test_custom_type_casters
0 commit comments