Skip to content

Commit 076dc90

Browse files
committed
Add Python 3.8 support
Prefer calling time.process_time() instead of time.clock() (which was deprecated in Python 3.3 and removed in Python 3.8). In addition, add Python 3.8 to the Travis CI build matrix.
1 parent 739c1c6 commit 076dc90

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

.travis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
language: python
22
python:
33
- "2.7"
4-
- "3.2"
5-
- "3.3"
6-
- "3.4"
74
- "3.5"
85
- "3.6"
9-
sudo: false
6+
- "3.7"
7+
- "3.8"
108
cache: pip
119
script: nosetests

EulerPy/utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@ def problem_glob(extension='.py'):
2323

2424
def clock():
2525
"""
26-
Under Windows, system CPU time can't be measured. Return time.clock()
27-
as user time and None as system time.
26+
Under Windows, system CPU time can't be measured. Return
27+
time.process_time() as user time and None as system time.
2828
"""
29-
return time.clock(), None
29+
# Legacy support for Python 3.2 and earlier.
30+
if sys.version_info < (3, 3, 0):
31+
return time.clock(), None
32+
33+
return time.process_time(), None
3034

3135
else:
3236
def clock():

0 commit comments

Comments
 (0)