Skip to content
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

Fixed overriding of Real and complex Fields #18312

Merged
merged 6 commits into from
Jan 13, 2020

Conversation

vikrantmalik051
Copy link
Contributor

@vikrantmalik051 vikrantmalik051 commented Jan 12, 2020

References to other Issues or PRs

Fixes #18278

Brief description of what is fixed or changed

Overriding of context created for ComplexField is fixed.

Other comments

Release Notes

  • polys
    • Prevent creation of CC from changing the context of RealElement.

@sympy-bot
Copy link

sympy-bot commented Jan 12, 2020

Hi, I am the SymPy bot (v149). 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:

  • polys
    • Prevent creation of CC from changing the context of RealElement. (#18312 by @V1krant)

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.6.

Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it.

Click here to see the pull request description that was parsed.

<!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->

#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234". See
https://github.com/blog/1506-closing-issues-via-pull-requests . Please also
write a comment on that issue linking back to this pull request once it is
open. -->
Fixes #18278 

#### Brief description of what is fixed or changed
Overriding of context created for ComplexField is fixed.

#### Other comments
#### Release Notes

<!-- Write the release notes for this release below. See
https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more information
on how to write release notes. The bot will check your release notes
automatically to see if they are formatted correctly. -->

<!-- BEGIN RELEASE NOTES -->
* polys
    * Prevent creation of CC from changing the context of RealElement.
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@@ -45,7 +45,7 @@ def parent(self):
@public
class MPContext(PythonMPContext):

def __init__(ctx, prec=53, dps=None, tol=None):
def __init__(ctx, field, prec=53, dps=None, tol=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use a flag with default value like real=False. It should also come after the existing parameters so that calls with positional parameters would not be disturbed.

ctx.mpf.context = ctx
ctx.mpc.context = ctx

if field == 'RR':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be more efficient to have a flag like real. Then this would be if real:.

@jksuom
Copy link
Member

jksuom commented Jan 13, 2020

There was a flake8 error, not related to this PR, that was fixed only after this was pushed. I have restarted the build.

@jksuom
Copy link
Member

jksuom commented Jan 13, 2020

This looks good. Can you add a test to show that now RR(2).parent() == 'RR'.

@jksuom
Copy link
Member

jksuom commented Jan 13, 2020

Thanks, this is ready to go.

@jksuom jksuom merged commit f119ab5 into sympy:master Jan 13, 2020
@codecov
Copy link

codecov bot commented Jan 13, 2020

Codecov Report

Merging #18312 into master will increase coverage by 0.02%.
The diff coverage is 100%.

@@             Coverage Diff             @@
##           master    #18312      +/-   ##
===========================================
+ Coverage   74.99%   75.011%   +0.02%     
===========================================
  Files         649       649              
  Lines      167331    167332       +1     
  Branches    39412     39413       +1     
===========================================
+ Hits       125483    125518      +35     
+ Misses      36307     36280      -27     
+ Partials     5541      5534       -7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RR.parent returns CC
4 participants