[Python-checkins] CVS: python/dist/src/Lib ntpath.py,1.21,1.22

Guido van Rossum guido@cnri.reston.va.us
Wed, 2 Feb 2000 11:54:42 -0500 (EST)


Update of /projects/cvsroot/python/dist/src/Lib
In directory eric:/projects/python/develop/guido/src/Lib

Modified Files:
	ntpath.py 
Log Message:
Optimize abspath() slightly for the case that win32api can't be
imported; in that case, abspath is replaced by a fallback version.


Index: ntpath.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Lib/ntpath.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** ntpath.py	1999/11/30 15:00:00	1.21
--- ntpath.py	2000/02/02 16:54:39	1.22
***************
*** 404,413 ****
      try:
          import win32api
-         try:
-             path = win32api.GetFullPathName(path)
-         except win32api.error:
-             pass # Bad path - return unchanged.
      except ImportError:
!         if not isabs(path):
!             path = join(os.getcwd(), path)
      return normpath(path)
--- 404,418 ----
      try:
          import win32api
      except ImportError:
!         global abspath
!         def _abspath(path):
!             if not isabs(path):
!                 path = join(os.getcwd(), path)
!             return normpath(path)
!         abspath = _abspath
!         return _abspath(path)
!     try:
!         path = win32api.GetFullPathName(path)
!     except win32api.error:
!         pass # Bad path - return unchanged.
      return normpath(path)