Skip to content

Commit d204526

Browse files
committed
Change visibilities of variant_visitor of pybind11
test=develop
1 parent b672291 commit d204526

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

paddle/fluid/pybind/protobuf.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ namespace pybind11 {
3030
namespace detail {
3131

3232
// Can be replaced by a generic lambda in C++14
33-
struct variant_caster_visitor : public boost::static_visitor<handle> {
33+
struct __attribute__((visibility("hidden"))) paddle_variant_caster_visitor
34+
: public boost::static_visitor<handle> {
3435
return_value_policy policy;
3536
handle parent;
3637

37-
variant_caster_visitor(return_value_policy policy, handle parent)
38+
paddle_variant_caster_visitor(return_value_policy policy, handle parent)
3839
: policy(policy), parent(parent) {}
3940

4041
template <class T>
@@ -44,10 +45,10 @@ struct variant_caster_visitor : public boost::static_visitor<handle> {
4445
};
4546

4647
template <class Variant>
47-
struct variant_caster;
48+
struct paddle_variant_caster;
4849

4950
template <template <class...> class V, class... Ts>
50-
struct variant_caster<V<Ts...>> {
51+
struct paddle_variant_caster<V<Ts...>> {
5152
using Type = V<Ts...>;
5253

5354
template <typename T>
@@ -90,7 +91,7 @@ struct variant_caster<V<Ts...>> {
9091

9192
static handle cast(Type const &src, return_value_policy policy,
9293
handle parent) {
93-
variant_caster_visitor visitor(policy, parent);
94+
paddle_variant_caster_visitor visitor(policy, parent);
9495
return boost::apply_visitor(visitor, src);
9596
}
9697

@@ -101,7 +102,7 @@ struct variant_caster<V<Ts...>> {
101102
// Add specialization for concrete variant type
102103
template <class... Args>
103104
struct type_caster<boost::variant<Args...>>
104-
: variant_caster<boost::variant<Args...>> {};
105+
: paddle_variant_caster<boost::variant<Args...>> {};
105106

106107
} // namespace detail
107108
} // namespace pybind11

paddle/fluid/pybind/pybind.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ bool IsCompiledWithDIST() {
8686
#endif
8787
}
8888

89-
PYBIND11_MODULE(core) {
89+
PYBIND11_MODULE(core, m) {
9090
// Not used, just make sure cpu_info.cc is linked.
9191
paddle::platform::CpuTotalPhysicalMemory();
9292

9393
paddle::memory::allocation::UseAllocatorStrategyGFlag();
94-
py::module m("core", "C++ core of PaddlePaddle");
94+
m.doc() = "C++ core of PaddlePaddle";
9595

9696
// using framework in this function. Since it is inside a function, it will
9797
// not cause namespace pollution.
@@ -907,7 +907,6 @@ All parameter, weight, gradient are variables in Paddle.
907907
});
908908

909909
BindRecordIOWriter(&m);
910-
return m.ptr();
911910
}
912911
} // namespace pybind
913912
} // namespace paddle

0 commit comments

Comments
 (0)