Skip to content

Commit

Permalink
BUG: stats: remove use of BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS
Browse files Browse the repository at this point in the history
This macro must not be used in the global scope, but rather in
a separate namespace (see, e.g., `boost_math/example/policy_eg_9.cpp`).
It caused compilation errors with Clang on Windows in
PR 246 on the conda-forge scipy feedback.

This bit of code also did not seem necessary, given that these
compile flags in `stats/_boost/meson.build` should already achieve
the same effect:
```
  '-DBOOST_MATH_EVALUATION_ERROR_POLICY=user_error',
  '-DBOOST_MATH_OVERFLOW_ERROR_POLICY=user_error',
```

That the custom error handling in `func_defs.hpp` is still used can
be verified by running for example after modifying the
`user_evaluation_error` handler:
```
python dev.py test -t scipy.stats.tests.test_distributions -- -k test_boost_eval_issue_14606
```
  • Loading branch information
rgommers authored and tylerjereddy committed Sep 26, 2023
1 parent 4e365bb commit 6ff8024
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions scipy/stats/_boost/include/func_defs.hpp
Expand Up @@ -11,12 +11,6 @@ typedef boost::math::policies::policy<
boost::math::policies::discrete_quantile<
boost::math::policies::integer_round_up > > Policy;

// Run user_error function when evaluation_errors and overflow_errors are encountered
typedef boost::math::policies::policy<
boost::math::policies::evaluation_error<boost::math::policies::user_error>,
boost::math::policies::overflow_error<boost::math::policies::user_error> > user_error_policy;
BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(user_error_policy)


// Raise a RuntimeWarning making users aware that something went wrong during
// evaluation of the function, but return the best guess
Expand Down

0 comments on commit 6ff8024

Please sign in to comment.