time.clock has gone

Issue #107 resolved
Patrick Vrijlandt created an issue

Hello,

passlib 1.7.1 fails to run under windows + python 3.8 (b1) because it references time.clock, which apparently has been removed from the standard library. The errors occur in utils.__init__ around line 844 (sorry, patched my local version) and line 907. Here is what I did:

line 842:
# pick best timer function to expose as "tick" - lifted from timeit module.
if sys.version_info > (3, 3):
    from time import process_time as timer
    # FIXME or time.monotonic or time.perf_counter or time.process_time or any of these with _ns
elif sys.platform == "win32":
    # On Windows, the best timer is time.clock()
    from time import clock as timer
else:
    # On most other platforms the best timer is time.time()
    from time import time as timer

line 896:   
    if sys.version_info > (3,3):
        clk = time.process_time()
    else:
        clk = time.clock()

with time.clock() replaced by clk in line 914

In both cases I’m not sure which timer function is best for passlib. (see the FIXME).

Comments (3)

  1. Log in to comment