[pypy-svn] r11866 - pypy/dist/pypy/module/builtin
pedronis at codespeak.net
pedronis at codespeak.net
Tue May 3 15:48:06 CEST 2005
Author: pedronis
Date: Tue May 3 15:48:06 2005
New Revision: 11866
Modified:
pypy/dist/pypy/module/builtin/importing.py
Log:
changes to pass test_pkgimport: in 2.3 SyntaxErrors (and only those) results in no module being put in sys.modules
Modified: pypy/dist/pypy/module/builtin/importing.py
==============================================================================
--- pypy/dist/pypy/module/builtin/importing.py (original)
+++ pypy/dist/pypy/module/builtin/importing.py Tue May 3 15:48:06 2005
@@ -25,10 +25,22 @@
if pkgdir is not None:
space.setattr(w_mod, w('__path__'), space.newlist([w(pkgdir)]))
w_dict = space.getattr(w_mod, w('__dict__'))
- space.builtin.call('execfile', w(f), w_dict, w_dict)
+ e = None
+ try:
+ space.builtin.call('execfile', w(f), w_dict, w_dict)
+ except OperationError, e:
+ if e.match(space, space.w_SyntaxError):
+ w_mods = space.sys.get('modules')
+ try:
+ space.delitem(w_mods, w_modulename)
+ except OperationError, e:
+ if not e.match(space, space.w_KeyError):
+ raise
w_mod = check_sys_modules(space, w_modulename)
if w_mod is not None and w_parent is not None:
space.setattr(w_parent, w_name, w_mod)
+ if e:
+ raise e
return w_mod
else:
return None
More information about the Pypy-commit
mailing list