Skip to content

Commit 33fb7a6

Browse files
committed
Show ODR VIOLATION DETECTED message only if PYBIND11_DETAIL_TYPE_CASTER_ODR_GUARD_IMPL_DEBUG is defined, to not clutter the test_gil_scoped.py output with many of these messages when multiprocessing.set_start_method("forkserver") is used.
1 parent 13eb5ea commit 33fb7a6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

include/pybind11/detail/type_caster_odr_guard.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ inline void type_caster_odr_guard_impl(const std::type_info &intrinsic_type_info
8282
+ reg_iter->second + "\", SourceLocation2=\"" + source_file_line_from_sloc
8383
+ "\"");
8484
if (throw_disabled) {
85+
# if defined(PYBIND11_DETAIL_TYPE_CASTER_ODR_GUARD_IMPL_DEBUG)
8586
std::fprintf(stderr, "\nDISABLED std::system_error: %s\n", msg.c_str());
8687
std::fflush(stderr);
88+
# endif
8789
type_caster_odr_violation_detected_counter()++;
8890
} else {
8991
throw std::system_error(std::make_error_code(std::errc::state_not_recoverable), msg);

0 commit comments

Comments
 (0)