From 58252111a1ab6ee6f1611a9556ad0f65e09087a0 Mon Sep 17 00:00:00 2001 From: Juarez Rudsatz Date: Fri, 11 Sep 2020 21:41:24 -0300 Subject: [PATCH] fix #484: compatibility with python3.8 in petl.timings.clock() --- docs/changes.rst | 8 +++++++- petl/util/timing.py | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/changes.rst b/docs/changes.rst index 4029fa17..de301532 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -1,6 +1,13 @@ Changes ======= +Version 1.6.6 +------------- + +* fix compatibility with python3.8 in `petl.timings.clock()`. + By :user:`juarezr`, :issue:`484`. + + Version 1.6.5 ------------- @@ -8,7 +15,6 @@ Version 1.6.5 By :user:`juarezr`, :issue:`514`. - Version 1.6.4 ------------- diff --git a/petl/util/timing.py b/petl/util/timing.py index e3e0903c..41e8ff6b 100644 --- a/petl/util/timing.py +++ b/petl/util/timing.py @@ -7,6 +7,7 @@ import time +from petl.compat import PY3 from petl.util.base import Table from petl.util.statistics import onlinestats @@ -246,11 +247,11 @@ def __iter__(self): self.time = 0 it = iter(self.wrapped) while True: - before = time.clock() + before = time.perf_counter() if PY3 else time.clock() try: row = next(it) except StopIteration: return - after = time.clock() + after = time.perf_counter() if PY3 else time.clock() self.time += (after - before) yield row