Index: Doc/lib/libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.114 diff -c -r1.114 libos.tex *** Doc/lib/libos.tex 14 Feb 2003 19:35:31 -0000 1.114 --- Doc/lib/libos.tex 3 Mar 2003 14:19:18 -0000 *************** *** 711,718 **** directory. Availability: Macintosh, \UNIX, Windows. ! \versionadded[On Windows NT/2k/XP, if \var{path} is a Unicode object, ! the result will be a list of Unicode objects.]{2.3} \end{funcdesc} \begin{funcdesc}{lstat}{path} --- 711,718 ---- directory. Availability: Macintosh, \UNIX, Windows. ! \versionadded[On Windows NT/2k/XP and MacOS X, if \var{path} is a Unicode ! object, the result will be a list of Unicode objects.]{2.3} \end{funcdesc} \begin{funcdesc}{lstat}{path} Index: Modules/posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.287 diff -c -r2.287 posixmodule.c *** Modules/posixmodule.c 25 Feb 2003 21:42:15 -0000 2.287 --- Modules/posixmodule.c 3 Mar 2003 14:19:20 -0000 *************** *** 1775,1781 **** PyObject *d, *v; DIR *dirp; struct dirent *ep; ! if (!PyArg_ParseTuple(args, "s:listdir", &name)) return NULL; if ((dirp = opendir(name)) == NULL) { return posix_error_with_filename(name); --- 1775,1787 ---- PyObject *d, *v; DIR *dirp; struct dirent *ep; ! int arg_is_unicode = 1; ! ! if (!PyArg_ParseTuple(args, "U:listdir", &v)) { ! arg_is_unicode = 0; ! PyErr_Clear(); ! } ! if (!PyArg_ParseTuple(args, "et:listdir", Py_FileSystemDefaultEncoding, &name)) return NULL; if ((dirp = opendir(name)) == NULL) { return posix_error_with_filename(name); *************** *** 1796,1816 **** break; } #ifdef Py_USING_UNICODE ! if (Py_FileSystemDefaultEncoding != NULL) { PyObject *w; w = PyUnicode_FromEncodedObject(v, Py_FileSystemDefaultEncoding, "strict"); - Py_DECREF(v); - v = w; - if (v == NULL) { - Py_DECREF(d); - d = NULL; - break; - } - /* attempt to convert to ASCII */ - w = PyUnicode_AsASCIIString(v); if (w != NULL) { Py_DECREF(v); v = w; --- 1802,1813 ---- break; } #ifdef Py_USING_UNICODE ! if (arg_is_unicode && Py_FileSystemDefaultEncoding != NULL) { PyObject *w; w = PyUnicode_FromEncodedObject(v, Py_FileSystemDefaultEncoding, "strict"); if (w != NULL) { Py_DECREF(v); v = w; Index: Misc/NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.685 diff -c -r1.685 NEWS *** Misc/NEWS 2 Mar 2003 00:19:49 -0000 1.685 --- Misc/NEWS 3 Mar 2003 14:19:21 -0000 *************** *** 38,48 **** about the rationale is in the NEWS entry for that. See also SF bug report . ! - os.listdir() now returns Unicode strings on platforms that set ! Py_FileSystemDefaultEncoding, for file names that are not representable ! in ASCII. (This currently only affects MacOS X; on Windows versions ! with wide file name support os.listdir() already returned Unicode ! strings.) - Distutils: both 'py_modules' and 'packages' keywords can now be specified in core.setup(). Previously you could supply one or the other, but --- 38,47 ---- about the rationale is in the NEWS entry for that. See also SF bug report . ! - If os.listdir() is called with a Unicode argument, it now returns ! Unicode strings on platforms that set Py_FileSystemDefaultEncoding. ! (This currently only affects MacOS X; on Windows versions ! with wide file name support os.listdir() already behaved like this.) - Distutils: both 'py_modules' and 'packages' keywords can now be specified in core.setup(). Previously you could supply one or the other, but *************** *** 85,92 **** Mac --- ! - os.listdir() now may return Unicode strings on MacOS X. See the general ! news item under "Library". - A new method MacOS.WMAvailable() returns true if it is safe to access the window manager, false otherwise. --- 84,91 ---- Mac --- ! - os.listdir() now returns Unicode strings on MacOS X when called with ! a Unicode argument. See the general news item under "Library". - A new method MacOS.WMAvailable() returns true if it is safe to access the window manager, false otherwise.