Skip to content

Commit 4d82cbb

Browse files
committed
bypass pybind warning
1 parent eb1b51d commit 4d82cbb

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

src/torchcodec/_core/AVIOFileLikeContext.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ namespace facebook::torchcodec {
1717

1818
// Enables uers to pass in a Python file-like object. We then forward all read
1919
// and seek calls back up to the methods on the Python object.
20-
class AVIOFileLikeContext : public AVIOContextHolder {
20+
class __attribute__((visibility("default"))) AVIOFileLikeContext
21+
: public AVIOContextHolder {
2122
public:
2223
explicit AVIOFileLikeContext(py::object fileLike);
2324

src/torchcodec/_core/CMakeLists.txt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ function(make_torchcodec_libraries
6666
set(decoder_sources
6767
AVIOContextHolder.cpp
6868
AVIOTensorContext.cpp
69+
AVIOFileLikeContext.cpp
6970
FFMPEGCommon.cpp
7071
Frame.cpp
7172
DeviceInterface.cpp
@@ -142,15 +143,6 @@ function(make_torchcodec_libraries
142143
"${pybind_ops_sources}"
143144
"${pybind_ops_dependencies}"
144145
)
145-
# pybind11 limits the visibility of symbols in the shared library to prevent
146-
# stray initialization of py::objects. The rest of the object code must
147-
# match. See:
148-
# https://pybind11.readthedocs.io/en/stable/faq.html#someclass-declared-with-greater-visibility-than-the-type-of-its-field-someclass-member-wattributes
149-
target_compile_options(
150-
${pybind_ops_library_name}
151-
PUBLIC
152-
"-fvisibility=hidden"
153-
)
154146
# If we don't make sure this flag is set, we run into segfauls at import
155147
# time on Mac. See:
156148
# https://github.com/pybind/pybind11/issues/3907#issuecomment-1170412764

0 commit comments

Comments
 (0)