Author: Stefano Rivera <[email protected]>
Branch:
Changeset: r64959:7bf8c506fa12
Date: 2013-06-23 23:04 +0200
http://bitbucket.org/pypy/pypy/changeset/7bf8c506fa12/
Log: rpython's int() doesn't allow any trailing non-integer characters
(such as a newline)
diff --git a/rpython/memory/gc/env.py b/rpython/memory/gc/env.py
--- a/rpython/memory/gc/env.py
+++ b/rpython/memory/gc/env.py
@@ -215,9 +215,12 @@
fd = os.open('/sys/devices/system/cpu/cpu' + assert_str0(str(cpu))
+ '/l2_cache_size', os.O_RDONLY, 0644)
try:
- number = int(os.read(fd, 4096))
+ line = os.read(fd, 4096)
finally:
os.close(fd)
+ end = len(line) - 1
+ assert end > 0
+ number = int(line[:end])
except OSError:
break
if number < L2cache:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit