[Python-checkins] python/dist/src/Lib ihooks.py, 1.18, 1.19 imputil.py, 1.26, 1.27

tim_one at users.sourceforge.net tim_one at users.sourceforge.net
Wed Aug 4 04:29:15 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29168/Lib

Modified Files:
	ihooks.py imputil.py 
Log Message:
ihooks FancyModuleLoader.load_module()
imputils Importer._process_result():
    remove name from modules dict if exec fails.

This is what all the builtin importers do now, new in 2.4.


Index: ihooks.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ihooks.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** ihooks.py	12 Feb 2004 17:35:06 -0000	1.18
--- ihooks.py	4 Aug 2004 02:29:12 -0000	1.19
***************
*** 323,327 ****
              m.__path__ = path
          m.__file__ = filename
!         exec code in m.__dict__
          return m
  
--- 323,333 ----
              m.__path__ = path
          m.__file__ = filename
!         try:
!             exec code in m.__dict__
!         except:
!             d = self.hooks.modules_dict()
!             if name in d:
!                 del d[name]
!             raise
          return m
  

Index: imputil.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/imputil.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** imputil.py	28 Jun 2002 23:32:51 -0000	1.26
--- imputil.py	4 Aug 2004 02:29:12 -0000	1.27
***************
*** 298,302 ****
          # execute the code within the module's namespace
          if not is_module:
!             exec code in module.__dict__
  
          # fetch from sys.modules instead of returning module directly.
--- 298,307 ----
          # execute the code within the module's namespace
          if not is_module:
!             try:
!                 exec code in module.__dict__
!             except:
!                 if fqname in sys.modules:
!                     del sys.modules[fqname]
!                 raise
  
          # fetch from sys.modules instead of returning module directly.



More information about the Python-checkins mailing list