Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch:
Changeset: r95395:74c1f4c8363d
Date: 2018-12-02 13:38 +0100
http://bitbucket.org/pypy/pypy/changeset/74c1f4c8363d/
Log: ouch: scoped_alloc can itself allocate a GC object, the with
handler! thus it can't be used here, now that time.time is used from
the GC.
diff --git a/rpython/rlib/rtime.py b/rpython/rlib/rtime.py
--- a/rpython/rlib/rtime.py
+++ b/rpython/rlib/rtime.py
@@ -136,7 +136,8 @@
void = lltype.nullptr(rffi.VOIDP.TO)
result = -1.0
if HAVE_GETTIMEOFDAY:
- with lltype.scoped_alloc(TIMEVAL) as t:
+ t = lltype.malloc(TIMEVAL, flavor='raw')
+ try:
errcode = -1
if GETTIMEOFDAY_NO_TZ:
errcode = c_gettimeofday(t)
@@ -145,13 +146,18 @@
if rffi.cast(rffi.LONG, errcode) == 0:
result = decode_timeval(t)
+ finally:
+ lltype.free(t, flavor='raw')
if result != -1:
return result
else: # assume using ftime(3)
- with lltype.scoped_alloc(TIMEB) as t:
+ t = lltype.malloc(TIMEB, flavor='raw')
+ try:
c_ftime(t)
result = (float(intmask(t.c_time)) +
float(intmask(t.c_millitm)) * 0.001)
+ finally:
+ lltype.free(t, flavor='raw')
return result
return float(c_time(void))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit