Skip to content

gh-79888: support __index__ and __float__ in time functions #11636

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jdemeyer
Copy link
Contributor

@jdemeyer jdemeyer commented Jan 21, 2019

https://bugs.python.org/issue35707

Note that there is substantial code duplication in my patch, but that is only because the existing code already had substantial duplication. It would be possible to fix that, at the expense of a slightly more complicated (and therefore probably slightly slower) implementation.

@jdemeyer
Copy link
Contributor Author

CC @abalkin as suggested by https://devguide.python.org/experts/

@jdemeyer
Copy link
Contributor Author

CC @pganssle

@pganssle pganssle self-requested a review June 18, 2019 14:00
@jdemeyer
Copy link
Contributor Author

it would be much better if we could make an assertion about the duration of the sleep in the Decimal('0.99') case

Good point, we could check that it takes at least 0.9 seconds to execute that.

@jdemeyer
Copy link
Contributor Author

jdemeyer commented Jul 4, 2019

Admittedly time.sleep is quite hard to test, so maybe this is the best we can do

There are already various tests for sleep time, so I'll base myself on those.

@jdemeyer
Copy link
Contributor Author

jdemeyer commented Jul 4, 2019

This is a bugfix (this used to work correctly before bpo-22117, in particular on Python 2.7), so should be backported.

@csabella csabella requested review from pganssle and abalkin and removed request for abalkin May 23, 2020 00:13
Copy link
Member

@iritkatriel iritkatriel left a comment

Choose a reason for hiding this comment

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

This has merge conflicts now.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@arhadthedev arhadthedev changed the title bpo-35707: support __index__ and __float__ in time functions gh-79888: support __index__ and __float__ in time functions May 6, 2023
@arhadthedev arhadthedev added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label May 6, 2023
@python-cla-bot
Copy link

python-cla-bot bot commented Apr 6, 2025

The following commit authors need to sign the Contributor License Agreement:

CLA signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants