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

Uses time.clock() on Windows which is gone with Python 3.8 #301

Closed
lazka opened this issue Jul 23, 2019 · 5 comments
Closed

Uses time.clock() on Windows which is gone with Python 3.8 #301

lazka opened this issue Jul 23, 2019 · 5 comments

Comments

@lazka
Copy link
Contributor

@lazka lazka commented Jul 23, 2019

time_func = time.clock

Traceback (most recent call last):
  File "C:\Python38\venv\cpython3.8-2459c2ec2c3d\lib\site-packages\pyperformance\benchmarks\bm_mako.py", line 20, in <module>
    from mako.template import Template   # noqa
  File "C:\Python38\venv\cpython3.8-2459c2ec2c3d\lib\site-packages\mako\template.py", line 10, in <module>
    from mako.lexer import Lexer
  File "C:\Python38\venv\cpython3.8-2459c2ec2c3d\lib\site-packages\mako\lexer.py", line 11, in <module>
    from mako import parsetree, exceptions, compat
  File "C:\Python38\venv\cpython3.8-2459c2ec2c3d\lib\site-packages\mako\parsetree.py", line 9, in <module>
    from mako import exceptions, ast, util, filters, compat
  File "C:\Python38\venv\cpython3.8-2459c2ec2c3d\lib\site-packages\mako\exceptions.py", line 11, in <module>
    from mako import util, compat
  File "C:\Python38\venv\cpython3.8-2459c2ec2c3d\lib\site-packages\mako\util.py", line 11, in <module>
    from mako import compat
  File "C:\Python38\venv\cpython3.8-2459c2ec2c3d\lib\site-packages\mako\compat.py", line 123, in <module>
    time_func = time.clock
AttributeError: module 'time' has no attribute 'clock'

Using timeit.default_timer() instead would work as far as I can see.

@zzzeek
Copy link
Member

@zzzeek zzzeek commented Jul 23, 2019

can we deprecate windows ? :) haha. OK, first I'm seeing about "default_timer" but it's documetned as always "perf_counter()" and in 3.3 on above. Can we use perf_counter() on all platforms ?

Loading

@zzzeek
Copy link
Member

@zzzeek zzzeek commented Jul 23, 2019

also are you available to send a PR using perf_counter() for Python 3.3 and above ? it would help a lot.

Loading

lazka added a commit to lazka/mako that referenced this issue Jul 24, 2019
…in Python 3.8

Python 3.8 has dropped the deprecated time.clock() function which makes mako fail
with an AttributeError on import on Windows.

The way time_func was defined (clock() on Windows and time() everywhere else) made it
return a high precision wall clock time without a defined reference. This is exactly
what timeit.default_timer() does for all versions of Python on all platforms,
so just use that instead.

Fixes sqlalchemy#301
@lazka
Copy link
Contributor Author

@lazka lazka commented Jul 24, 2019

Sure -> #302

Loading

@sqla-tester
Copy link
Collaborator

@sqla-tester sqla-tester commented Jul 26, 2019

Christoph Reiter has proposed a fix for this issue in the master branch:

compat: use timeit.default_timer instead of time.clock which is gone in Python 3.8 https://gerrit.sqlalchemy.org/1377

Loading

@sqla-tester
Copy link
Collaborator

@sqla-tester sqla-tester commented Jul 27, 2019

Christoph Reiter has proposed a fix for this issue in the master branch:

use timeit.default_timer instead of time.clock() / time.time() https://gerrit.sqlalchemy.org/1377

Loading

lazka added a commit to lazka/pyperformance that referenced this issue Aug 9, 2019
The last release allows mako to run on Windows with Python 3.8, see
sqlalchemy/mako#301 for details

Fixes python#63
vstinner added a commit to python/pyperformance that referenced this issue Aug 12, 2019
The last release allows mako to run on Windows with Python 3.8, see
sqlalchemy/mako#301 for details

Fixes #63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants