[pypy-svn] r54560 - pypy/dist/pypy/lib
haypo at codespeak.net
haypo at codespeak.net
Thu May 8 15:12:26 CEST 2008
Author: haypo
Date: Thu May 8 15:12:25 2008
New Revision: 54560
Modified:
pypy/dist/pypy/lib/resource.py
Log:
Fix "from resource import *": only export existing optional constants
Modified: pypy/dist/pypy/lib/resource.py
==============================================================================
--- pypy/dist/pypy/lib/resource.py (original)
+++ pypy/dist/pypy/lib/resource.py Thu May 8 15:12:25 2008
@@ -58,9 +58,11 @@
rlim_t = config['rlim_t']
for key in _CONSTANTS:
globals()[key] = config[key]
+optional_constants = []
for key in _OPTIONAL_CONSTANTS:
if config[key] is not None:
globals()[key] = config[key]
+ optional_constants.append(key)
del config
class ResourceError(OSError):
@@ -170,8 +172,10 @@
# Irix 5.3 has _SC_PAGESIZE, but not _SC_PAGE_SIZE
return sysconf("SC_PAGESIZE")
-__all__ = _CONSTANTS + _OPTIONAL_CONSTANTS + (
+__all__ = _CONSTANTS + tuple(optional_constants) + (
'ResourceError', 'timeval', 'struct_rusage', 'rlimit',
'getrusage', 'getrlimit', 'setrlimit', 'getpagesize',
)
+del optional_constants
+
More information about the Pypy-commit
mailing list