-
-
Notifications
You must be signed in to change notification settings - Fork 674
Update for mpmath-1.4 while remaining backwards-compatible #41014
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
Draft
orlitzky
wants to merge
12
commits into
sagemath:develop
Choose a base branch
from
orlitzky:mpmath-1.4
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tweak some expected output to work with both versions of mpmath. Certain types that used to be implemented in sage are now a part of mpmath itself, so the class names have changed. Fortunately it looks like we can match both with enough "..."
This file needs an update to support mpmath-1.4.x, and the changes can't easily be conditionalized (cimports are involved). Instead we make a copy, with the intention of using meson to conditionally compile one or the other based on the value of mpmath.__version__ at build-time.
To support both versions of mpmath, we create an internal copy of the existing py_scalar_parent() function, and update the original to support mpmath-1.4.x. If mpmath.__version__ indicates that v1.3 is in use, we punt to the old copy of the function. The copy/paste is ugly, but considering that it's only temporary, emphasis is placed on how easy it will be to undo eventually.
mpmath v1.3 and v1.4 build very differently. Rather than try to support both simultaneously with the same set of files, we conditionalize the build to check mpmath.__version__ via python, and respond accordingly.
To support mpmath v1.3 and v1.4 simultaneously, we have some sage library files that are only used mpmath-1.3.x is installed. The tests in these files will fail with mpmath-1.4, however, so we add a new feature to detect mpmath-1.3.x.
Most of these files are only used (and can only be tested) under mpmath-1.3.x. We now have a "feature" for that version, and just need to add the appropriate file-level tags.
Now that we have a feature for "mpmath13", the doctests for the mpmath-1.3.x copy of py_scalar_parent() are put back in place.
It isn't smart enough to handle an if/else statement that doesn't apply.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A third attempt at supporting mpmath 1.4.x. Previous PRs:
build/pkgs/mpmath
1.4 #38565mpmath 1.4.x is still in alpha, so we can't require it yet, but we can try to support it. This isn't too difficult given that
mpmath.__version__
is available to python, but there are some major cython changes that are better hidden behind a conditional compile.The new PR makes things compatible where possible, copy/pastes an entire function in one case, and even uses a separate file
utils13.pyx
in another. A new feature is added to hide the 1.3.x doctests on 1.4.