[pypy-svn] r76226 - pypy/branch/unicode_filename-2/pypy/module/posix

afa at codespeak.net afa at codespeak.net
Thu Jul 15 09:07:44 CEST 2010


Author: afa
Date: Thu Jul 15 09:07:40 2010
New Revision: 76226

Modified:
   pypy/branch/unicode_filename-2/pypy/module/posix/interp_posix.py
Log:
Fix translation: the return type can be either str or unicode,
and must be wrapped inside each branch.


Modified: pypy/branch/unicode_filename-2/pypy/module/posix/interp_posix.py
==============================================================================
--- pypy/branch/unicode_filename-2/pypy/module/posix/interp_posix.py	(original)
+++ pypy/branch/unicode_filename-2/pypy/module/posix/interp_posix.py	Thu Jul 15 09:07:40 2010
@@ -321,11 +321,18 @@
 def _getfullpathname(space, w_path):
     """helper for ntpath.abspath """
     try:
-        fullpath = dispatch_filename(rposix._getfullpathname)(space, w_path)
+        if space.isinstance_w(w_path, space.w_unicode):
+            path = FileEncoder(space, w_path)
+            fullpath = rposix._getfullpathname(path)
+            w_fullpath = space.wrap(fullpath)
+        else:
+            path = space.str_w(w_path)
+            fullpath = rposix._getfullpathname(path)
+            w_fullpath = space.wrap(fullpath)
     except OSError, e:
         raise wrap_oserror2(space, e, w_path)
     else:
-        return space.wrap(fullpath)
+        return w_fullpath
 _getfullpathname.unwrap_spec = [ObjSpace, W_Root]
 
 def getcwd(space):



More information about the Pypy-commit mailing list