[FIX] *: python 3.8 compatibility

time.clock is deprecated since python 3.3 and no longer exists in python 3.8
time.process_time was introduced in python 3.3

Replace "is" by "==" as this produces a SyntaxWarning in python 3.8

Fixes odoo/odoo#41313

closes odoo/odoo#44502

X-original-commit: f03b4cb5576f264b6845242ba112f02422af4f5f
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
This commit is contained in:
Martin Trigaux
2020-02-03 14:38:20 +00:00
parent 5a6165da84
commit eafa9f4abc
3 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -93,7 +93,7 @@ class Partner(models.Model):
state = 'old'
break
if partner.free_member and state is not 'paid':
if partner.free_member and state != 'paid':
state = 'free'
partner.membership_state = state
+3 -3
View File
@@ -36,10 +36,10 @@ class m(models.Model):
@api.model
def consume_cpu_time(self, seconds):
t0 = time.clock()
t1 = time.clock()
t0 = time.process_time()
t1 = time.process_time()
while t1 - t0 < seconds:
for i in range(10000000):
x = i * i
t1 = time.clock()
t1 = time.process_time()
return True
+2 -2
View File
@@ -3576,9 +3576,9 @@ class Id(Field):
# the code below is written to make record.id as quick as possible
ids = record._ids
size = len(ids)
if size is 0:
if size == 0:
return False
elif size is 1:
elif size == 1:
return ids[0]
raise ValueError("Expected singleton: %s" % record)