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

validate.py uses library function removed in Python 3.8 #250

Closed
magnusbaeck opened this issue Dec 12, 2020 · 0 comments · Fixed by #251
Closed

validate.py uses library function removed in Python 3.8 #250

magnusbaeck opened this issue Dec 12, 2020 · 0 comments · Fixed by #251

Comments

@magnusbaeck
Copy link
Member

Description

When examples/validate.py is run with Python 3.7 there are two deprecation warnings:

$ python3 --version
Python 3.7.3
$ python3 examples/validate.py
Loaded 99 schemas.
Loaded 94 examples.
examples/validate.py:93: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
  latestReportTime = time.clock()
examples/validate.py:114: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
  if time.clock() - latestReportTime > 5:

===SUMMARY===
Bad schema files:         0
Bad example files:        0
Successful validations:   94
Failed validations:       0
Unchecked examples:       0
=============

We should replace the time.clock() calls with time.perf_counter() according to the suggestion.

Motivation

Programs should not use deprecated library functions that have been removed from the Python release that was deemed stable over a year ago.

Exemplification

The script will continue to work when users upgrade their OSes the next time.

Benefits

The script won't emit warnings under Python 3.7 and will continue working when users upgrade to Python 3.8.

Possible Drawbacks

We'll effectively drop Python 2 support, but Python 2 was EOLed on 2020-01-01 and any reasonably modern OS will support Python 3.3+.

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 a pull request may close this issue.

1 participant