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

Decrapation of time.clock() method in python 3.8 #28

Closed
raserhin opened this issue Dec 13, 2019 · 1 comment
Closed

Decrapation of time.clock() method in python 3.8 #28

raserhin opened this issue Dec 13, 2019 · 1 comment

Comments

@raserhin
Copy link

raserhin commented Dec 13, 2019

As you can see in this issue from the CPython repository the method time.clock() has been removed as of version 3.8 (Official python bug).

In your clock() function inside the utils module you are using this method making this whole package unusable (in case the resource module is not importable)

# Use the resource module instead of time.clock() if possible (on Unix)
try:
    import resource

except ImportError:
    import time

    def clock():
        """
        Under Windows, system CPU time can't be measured. Return time.clock()
        as user time and None as system time.
        """
        return time.clock(), None

else:
    def clock():
        """
        Returns a tuple (t_user, t_system) since the start of the process.
        This is done via a call to resource.getrusage, so it avoids the
        wraparound problems in time.clock().
        """
        return resource.getrusage(resource.RUSAGE_CHILDREN)[:2]

I don't know how willingly are you about still maintaining this repository. But I had to change this locally in my windows machine.

@iKevinY
Copy link
Owner

iKevinY commented Dec 14, 2019

Thank you for the heads up! It's definitely been several years since I've touched this project, but the patch was simple enough, so I've gone and addressed this (hopefully) in 076dc90, and added Python 3.8 to the build matrix to catch other regressions.

I'll try to push a new package release if I can remember how to do that…

Edit: It's been released in 1.4.0!

@iKevinY iKevinY closed this as completed Dec 14, 2019
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

No branches or pull requests

2 participants