[pypy-svn] r75354 - pypy/release/1.3.x/pypy/module/imp
fijal at codespeak.net
fijal at codespeak.net
Sun Jun 13 00:20:06 CEST 2010
Author: fijal
Date: Sun Jun 13 00:20:04 2010
New Revision: 75354
Modified:
pypy/release/1.3.x/pypy/module/imp/importing.py
Log:
Only use cpyext if it's loaded. That's an a safety switch saying
"I know what I'm doing" when using cpyext
Modified: pypy/release/1.3.x/pypy/module/imp/importing.py
==============================================================================
--- pypy/release/1.3.x/pypy/module/imp/importing.py (original)
+++ pypy/release/1.3.x/pypy/module/imp/importing.py Sun Jun 13 00:20:04 2010
@@ -53,9 +53,18 @@
return PY_COMPILED, ".pyc", "rb"
if space.config.objspace.usemodules.cpyext:
- pydfile = filepart + so_extension
- if os.path.exists(pydfile) and case_ok(pydfile):
- return C_EXTENSION, so_extension, "rb"
+ try:
+ space.getitem(space.getattr(space.sys,
+ space.wrap('modules')),
+ space.wrap('cpyext'))
+ except OperationError, o:
+ if not o.match(space, space.w_KeyError):
+ raise
+ else:
+ # cpyext was loaded, try to load cpython extensions
+ pydfile = filepart + so_extension
+ if os.path.exists(pydfile) and case_ok(pydfile):
+ return C_EXTENSION, so_extension, "rb"
return SEARCH_ERROR, None, None
More information about the Pypy-commit
mailing list