Replace error printing code gated by NDEBUG with a new flag: PYBIND11_DETAILED_ERROR_MESSAGES (#3913)

* Update cast.h

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Move definition to detail/common, change name, apply everywhere

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Rename debug_enabled in tests to detailed_error_messages_enabled
This commit is contained in:
Michael Voznesensky
2022-05-02 12:30:19 -07:00
committed by GitHub
parent 75007dda72
commit f0b9f755e4
10 changed files with 82 additions and 66 deletions

View File

@@ -67,10 +67,10 @@ PYBIND11_MODULE(pybind11_tests, m) {
bind_ConstructorStats(m);
#if !defined(NDEBUG)
m.attr("debug_enabled") = true;
#if defined(PYBIND11_DETAILED_ERROR_MESSAGES)
m.attr("detailed_error_messages_enabled") = true;
#else
m.attr("debug_enabled") = false;
m.attr("detailed_error_messages_enabled") = false;
#endif
py::class_<UserType>(m, "UserType", "A `py::class_` type for testing")