-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
bug fix: MinMaxBase.__new__() does not use global parameter for argument "evaluate" #23663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Hi, I am the SymPy bot (v167). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.11. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
Benchmark results from GitHub Actions Lower numbers are good, higher numbers are bad. A ratio less than 1 Significantly changed benchmark results (PR vs master) Significantly changed benchmark results (master vs previous release) before after ratio
[77f1d79c] [a28a214e]
<sympy-1.10.1^0>
+ 98.1±0.7ms 179±0.6ms 1.83 sum.TimeSum.time_doit
Full benchmark results can be found as artifacts in GitHub Actions |
@@ -380,7 +380,8 @@ def real_root(arg, n=None, evaluate=None): | |||
|
|||
class MinMaxBase(Expr, LatticeOp): | |||
def __new__(cls, *args, **assumptions): | |||
evaluate = assumptions.pop('evaluate', True) | |||
from sympy.core.parameters import global_parameters | |||
evaluate = assumptions.pop('evaluate', global_parameters.evaluate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for this in sympy/functions/elementary/tests/test_miscellaneous.py
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also added a new context NoEvaluation
in the test file. This ensures that even if the new test_minmax_no_evaluate
fails, it will not affect other tests by always setting the gp.evaluate
back to True
at its exit. Otherwise, we risk ending up in an environment where gp.evaluate=False
for other tests if test_minmax_no_evaluate
raises errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There already is a context manager for this:
In [10]: from sympy import *
In [11]: x = symbols('x')
In [12]: with evaluate(False):
...: s = x + x
...:
In [13]: s
Out[13]: x + x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx, I'll switch to that.
I'm not sure what causes the matplotlib failures in the 3.11 optional dependency tests but it's not caused by this PR. |
Looks good. Thanks! |
References to other Issues or PRs
Brief description of what is fixed or changed
Fixed a bug that MinMaxBase.new() does not use global parameter for argument "evaluate"
Other comments
Release Notes