[pypy-svn] r56354 - in pypy/dist/pypy/module/posix: . test
cfbolz at codespeak.net
cfbolz at codespeak.net
Mon Jul 7 16:31:04 CEST 2008
Author: cfbolz
Date: Mon Jul 7 16:31:02 2008
New Revision: 56354
Modified:
pypy/dist/pypy/module/posix/interp_posix.py
pypy/dist/pypy/module/posix/test/test_posix2.py
Log:
A forgotten error-check in os.sysconf.
Modified: pypy/dist/pypy/module/posix/interp_posix.py
==============================================================================
--- pypy/dist/pypy/module/posix/interp_posix.py (original)
+++ pypy/dist/pypy/module/posix/interp_posix.py Mon Jul 7 16:31:02 2008
@@ -630,8 +630,13 @@
ttyname.unwrap_spec = [ObjSpace, int]
def sysconf(space, w_num_or_name):
+ # XXX slightly non-nice, reuses the sysconf of the underlying os module
if space.is_true(space.isinstance(w_num_or_name, space.w_basestring)):
- num = os.sysconf_names[space.str_w(w_num_or_name)]
+ try:
+ num = os.sysconf_names[space.str_w(w_num_or_name)]
+ except KeyError:
+ raise OperationError(space.w_ValueError,
+ space.wrap("unrecognized configuration name"))
else:
num = space.int_w(w_num_or_name)
return space.wrap(os.sysconf(num))
Modified: pypy/dist/pypy/module/posix/test/test_posix2.py
==============================================================================
--- pypy/dist/pypy/module/posix/test/test_posix2.py (original)
+++ pypy/dist/pypy/module/posix/test/test_posix2.py Mon Jul 7 16:31:02 2008
@@ -328,6 +328,10 @@
assert os.sysconf(self.sysconf_name) == self.sysconf_result
assert os.sysconf_names[self.sysconf_name] == self.sysconf_value
+ def test_os_sysconf_error(self):
+ os = self.posix
+ raises(ValueError, os.sysconf, "!@#$%!#$!@#")
+
def test_largefile(self):
os = self.posix
fd = os.open(self.path2 + 'test_largefile', os.O_RDWR | os.O_CREAT, 0666)
More information about the Pypy-commit
mailing list