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

bpo-39648:[WIP]updated math.gcd to accept 'n' arguments. #18590

Closed
wants to merge 17 commits into from
Closed

bpo-39648:[WIP]updated math.gcd to accept 'n' arguments. #18590

wants to merge 17 commits into from

Conversation

ananthan-123
Copy link
Contributor

@ananthan-123 ananthan-123 commented Feb 21, 2020

@ananthan-123 ananthan-123 changed the title bpo-39648:updated math.gcd to accept 'n' arguments. bpo-39648:[WIP]updated math.gcd to accept 'n' arguments. Feb 21, 2020
@ananthan-123
Copy link
Contributor Author

I made clinic and now it is showing checksum error.
What to do?

@mdickinson
Copy link
Member

mdickinson commented Feb 21, 2020

What error are you getting? make clinic runs fine for me on commit 660448e, and has no effect on mathmodule.c.h, so it looks as though everything is up to date here.

@mdickinson
Copy link
Member

mdickinson commented Feb 21, 2020

Ah, I think I understand: after you merge the upstream master in, you'll get conflicts in mathmodule.c.h. You can either restore mathmodule.c.h to either the local version or the upstream version (check out git checkout --ours and git checkout --theirs), or perhaps more simply, I believe it should always be safe to simply delete mathmodule.c.h entirely and then regenerate it using make clinic.

@ananthan-123
Copy link
Contributor Author

I think the test failure is due to some other problem!!

@mdickinson
Copy link
Member

I think the test failure is due to some other problem!!

Yes. You need to initialise g to be the integer zero (it's currently initialised to the NULL pointer, and then that NULL pointer gets passed into the first call to _PyLong_GCD). After that, there are some reference leaks to sort out.

Copy link
Member

@sweeneyde sweeneyde left a comment

Choose a reason for hiding this comment

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

I think the main bug is that there is a difference between the C value 0 (aka a null pointer) and the Python int 0.

@ananthan-123
Copy link
Contributor Author

Updated the code.
Do we have to decref 'item'.

ananthan-123 and others added 3 commits February 22, 2020 14:10
Co-Authored-By: sweeneyde <36520290+sweeneyde@users.noreply.github.com>
Co-Authored-By: sweeneyde <36520290+sweeneyde@users.noreply.github.com>
@mdickinson
Copy link
Member

Do we have to decref 'item'.

No: item is effectively a borrowed reference; no need to decref. Having said that, you don't really need a separate item at all. You could replace:

item = args[i];
in = PyNumber_Index(item);

with simply

in = PyNumber_Index(args[i]);

@ananthan-123
Copy link
Contributor Author

Thanks for the review.Made suitable changes.

@ananthan-123
Copy link
Contributor Author

Now the problem is with clinic(don't know if any other problem is there).Don't we have to make clinic.
Do we have to regain previous clinic file.

@mdickinson
Copy link
Member

Closing, since #18604 was merged.

@mdickinson mdickinson closed this Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants