[Python-checkins] r72274 - in python/branches/py3k: Misc/NEWS Modules/posixmodule.c
hirokazu.yamamoto
python-checkins at python.org
Mon May 4 07:56:46 CEST 2009
Author: hirokazu.yamamoto
Date: Mon May 4 07:56:46 2009
New Revision: 72274
Log:
Merged revisions 72273 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72273 | hirokazu.yamamoto | 2009-05-04 14:28:39 +0900 | 1 line
Issue #5913: os.listdir() should fail for empty path on windows.
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Misc/NEWS
python/branches/py3k/Modules/posixmodule.c
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Mon May 4 07:56:46 2009
@@ -109,6 +109,8 @@
Library
-------
+- Issue #5913: os.listdir() should fail for empty path on windows.
+
- Issue #5084: unpickling now interns the attribute names of pickled objects,
saving memory and avoiding growth in size of subsequent pickles. Proposal
and original patch by Jake McGuire.
Modified: python/branches/py3k/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k/Modules/posixmodule.c (original)
+++ python/branches/py3k/Modules/posixmodule.c Mon May 4 07:56:46 2009
@@ -2183,7 +2183,6 @@
if (PyArg_ParseTuple(args, "U:listdir", &po)) {
WIN32_FIND_DATAW wFileData;
Py_UNICODE *wnamebuf;
- Py_UNICODE wch;
/* Overallocate for \\*.*\0 */
len = PyUnicode_GET_SIZE(po);
wnamebuf = malloc((len + 5) * sizeof(wchar_t));
@@ -2192,10 +2191,12 @@
return NULL;
}
wcscpy(wnamebuf, PyUnicode_AS_UNICODE(po));
- wch = len > 0 ? wnamebuf[len-1] : '\0';
- if (wch != L'/' && wch != L'\\' && wch != L':')
- wnamebuf[len++] = L'\\';
- wcscpy(wnamebuf + len, L"*.*");
+ if (len > 0) {
+ Py_UNICODE wch = wnamebuf[len-1];
+ if (wch != L'/' && wch != L'\\' && wch != L':')
+ wnamebuf[len++] = L'\\';
+ wcscpy(wnamebuf + len, L"*.*");
+ }
if ((d = PyList_New(0)) == NULL) {
free(wnamebuf);
return NULL;
@@ -2266,8 +2267,8 @@
char ch = namebuf[len-1];
if (ch != SEP && ch != ALTSEP && ch != ':')
namebuf[len++] = '/';
+ strcpy(namebuf + len, "*.*");
}
- strcpy(namebuf + len, "*.*");
if ((d = PyList_New(0)) == NULL)
return NULL;
More information about the Python-checkins
mailing list