Skip to content

Add as_integer_ratio to PyInt #1759

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

Merged
merged 1 commit into from
Feb 12, 2020
Merged

Add as_integer_ratio to PyInt #1759

merged 1 commit into from
Feb 12, 2020

Conversation

minhnhdo
Copy link
Contributor

This pull request adds support for as_integer_ratio to the VM's integer number type, PyInt.

Current behavior on master

>>>>> (10).as_integer_ratio()        
Traceback (most recent call last):                                             
  File "<stdin>", line 1, in <module>
AttributeError: 'int' object has no attribute 'as_integer_ratio'
>>>>> 

Behavior after this pull request

>>>>> (10).as_integer_ratio()
(10, 1)
>>>>> 

@minhnhdo
Copy link
Contributor Author

minhnhdo commented Feb 11, 2020

It looks like the failed runs are due to int.as_integer_ratio not being available in CPython 3.6. Should I just delete the tests?

@youknowone
Copy link
Member

Thanks for your contributing.
Upgrading test to use 3.8 will be the best. If it is hard, add an if-statement for python version like:

import sys
if sys.version_info >= (3, 8):
    # run 3.8 test here

@minhnhdo
Copy link
Contributor Author

I'll try upgrading the Python version in GitHub workflow first.

@palaviv
Copy link
Contributor

palaviv commented Feb 11, 2020

Upgrading test to use 3.8 will be the best. If it is hard, add an if-statement for python version like:

@youknowone have already tried upgrading to 3.8 in #1705. I think that commenting out the tests and adding a TODO will be good enough.

@minhnhdo
Copy link
Contributor Author

@palaviv, sure, I'll modify this PR.

@coolreader18 coolreader18 merged commit 133a571 into RustPython:master Feb 12, 2020
@coolreader18
Copy link
Member

Thank you for contributing!

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

Successfully merging this pull request may close these issues.

4 participants