[Python-checkins] r72312 - python/branches/pep-0383/Modules/posixmodule.c

martin.v.loewis python-checkins at python.org
Tue May 5 06:37:58 CEST 2009


Author: martin.v.loewis
Date: Tue May  5 06:37:57 2009
New Revision: 72312

Log:
Fix Windows compilation problems.

Modified:
   python/branches/pep-0383/Modules/posixmodule.c

Modified: python/branches/pep-0383/Modules/posixmodule.c
==============================================================================
--- python/branches/pep-0383/Modules/posixmodule.c	(original)
+++ python/branches/pep-0383/Modules/posixmodule.c	Tue May  5 06:37:57 2009
@@ -1686,7 +1686,7 @@
 	if (!PyArg_ParseTuple(args, "O&i:access",
 			      PyUnicode_FSConverter, &opath, &mode))
 		return 0;
-	path = bytes2str(opath);
+	path = bytes2str(opath, 1);
 	Py_BEGIN_ALLOW_THREADS
 	attr = GetFileAttributesA(path);
 	Py_END_ALLOW_THREADS
@@ -2225,6 +2225,7 @@
 	HANDLE hFindFile;
 	BOOL result;
 	WIN32_FIND_DATA FileData;
+	PyObject *opath;
 	char namebuf[MAX_PATH+5]; /* Overallocate for \\*.*\0 */
 	char *bufptr = namebuf;
 	Py_ssize_t len = sizeof(namebuf)-5; /* only claim to have space for MAX_PATH */
@@ -2589,7 +2590,7 @@
 		release_bytes(opath);
 		return NULL;
 	}
-	release_bytes(path);
+	release_bytes(opath);
 	if (PyUnicode_Check(PyTuple_GetItem(args, 0))) {
 		return PyUnicode_Decode(outbuf, strlen(outbuf),
 			Py_FileSystemDefaultEncoding, NULL);
@@ -2946,7 +2947,7 @@
 		if (!PyArg_ParseTuple(args, "O&O:utime",
 				PyUnicode_FSConverter, &oapath, &arg))
 			return NULL;
-		apath = bytes2str(oapath);
+		apath = bytes2str(oapath, 1);
 		Py_BEGIN_ALLOW_THREADS
 		hFile = CreateFileA(apath, FILE_WRITE_ATTRIBUTES, 0,
 				    NULL, OPEN_EXISTING,
@@ -2954,7 +2955,7 @@
 		Py_END_ALLOW_THREADS
 		if (hFile == INVALID_HANDLE_VALUE) {
 			win32_error("utime", apath);
-			release(oapath);
+			release_bytes(oapath);
 			return NULL;
 		}
 		release_bytes(oapath);
@@ -3352,7 +3353,6 @@
 	PyObject *opath;
 	char *path;
 	PyObject *argv;
-	PyObject **oargvlist;
 	char **argvlist;
 	int mode, i;
 	Py_ssize_t argc;
@@ -3366,7 +3366,7 @@
 			      PyUnicode_FSConverter,
 			      &opath, &argv))
 		return NULL;
-	path = bytes2str(opath);
+	path = bytes2str(opath, 1);
 	if (PyList_Check(argv)) {
 		argc = PyList_Size(argv);
 		getitem = PyList_GetItem;
@@ -3389,7 +3389,7 @@
 	}
 	for (i = 0; i < argc; i++) {
 		if (!fsconvert_strdup((*getitem)(argv, i),
-				      &oargvlist[i])) {
+				      &argvlist[i])) {
 			free_string_array(argvlist, i);
 			PyErr_SetString(
 				PyExc_TypeError,
@@ -3459,7 +3459,7 @@
 			      PyUnicode_FSConverter,
 			      &opath, &argv, &env))
 		return NULL;
-	path = bytes2str(opath);
+	path = bytes2str(opath, 1);
 	if (PyList_Check(argv)) {
 		argc = PyList_Size(argv);
 		getitem = PyList_GetItem;
@@ -6795,6 +6795,7 @@
 static PyObject *
 win32_startfile(PyObject *self, PyObject *args)
 {
+	PyObject *ofilepath;
 	char *filepath;
 	char *operation = NULL;
 	HINSTANCE rc;
@@ -6840,7 +6841,7 @@
 			      PyUnicode_FSConverter, &ofilepath, 
 			      &operation))
 		return NULL;
-	filepath = bytes2str(ofilepath);
+	filepath = bytes2str(ofilepath, 1);
 	Py_BEGIN_ALLOW_THREADS
 	rc = ShellExecute((HWND)0, operation, filepath, 
 			  NULL, NULL, SW_SHOWNORMAL);


More information about the Python-checkins mailing list