[pypy-svn] r64645 - in pypy/branch/unicode_filename/pypy: module/posix rpython/module
afa at codespeak.net
afa at codespeak.net
Fri Apr 24 18:17:10 CEST 2009
Author: afa
Date: Fri Apr 24 18:17:08 2009
New Revision: 64645
Modified:
pypy/branch/unicode_filename/pypy/module/posix/interp_posix.py
pypy/branch/unicode_filename/pypy/rpython/module/ll_os.py
Log:
Fix os.getcwdu() to return a unicode as advertised.
This fixes the last failure on Windows!
Modified: pypy/branch/unicode_filename/pypy/module/posix/interp_posix.py
==============================================================================
--- pypy/branch/unicode_filename/pypy/module/posix/interp_posix.py (original)
+++ pypy/branch/unicode_filename/pypy/module/posix/interp_posix.py Fri Apr 24 18:17:08 2009
@@ -343,12 +343,15 @@
def getcwdu(space):
"""Return a unicode string representing the current working directory."""
- try:
- cur = os.getcwdu()
- except OSError, e:
- raise wrap_oserror(space, e)
- else:
+ if _WIN:
+ try:
+ cur = os.getcwdu()
+ except OSError, e:
+ raise wrap_oserror(space, e)
return space.wrap(cur)
+ else:
+ # XXX sys.getfilesystemencoding() is None on Linux
+ return space.call_method(getcwd(space), 'decode')
getcwd.unwrap_spec = [ObjSpace]
def chdir(space, w_path):
Modified: pypy/branch/unicode_filename/pypy/rpython/module/ll_os.py
==============================================================================
--- pypy/branch/unicode_filename/pypy/rpython/module/ll_os.py (original)
+++ pypy/branch/unicode_filename/pypy/rpython/module/ll_os.py Fri Apr 24 18:17:08 2009
@@ -952,11 +952,13 @@
tp = str
TP = rffi.CCHARP
charp2str = rffi.charp2str
+ fnname = underscore_on_windows + 'getcwd'
else:
tp = unicode
TP = rffi.CWCHARP
charp2str = rffi.wcharp2unicode
- os_getcwd = self.llexternal(underscore_on_windows + 'getcwd',
+ fnname = underscore_on_windows + 'wgetcwd'
+ os_getcwd = self.llexternal(fnname,
[TP, rffi.SIZE_T],
TP)
@@ -988,6 +990,7 @@
@registering(os.getcwdu)
def register_os_getcwdu(self):
+ # XXX only on Windows!
return self.register_os_getcwd(unicodepath=True)
@registering(os.listdir)
More information about the Pypy-commit
mailing list