[Python-checkins] python/dist/src/Modules posixmodule.c, 2.302, 2.303

loewis at users.sourceforge.net loewis at users.sourceforge.net
Fri Sep 12 12:25:40 EDT 2003


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv24955/Modules

Modified Files:
	posixmodule.c 
Log Message:
Patch #790000: Allow os.access to handle Unicode file name.


Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.302
retrieving revision 2.303
diff -C2 -d -r2.302 -r2.303
*** posixmodule.c	1 Sep 2003 22:25:41 -0000	2.302
--- posixmodule.c	12 Sep 2003 16:25:38 -0000	2.303
***************
*** 1028,1031 ****
--- 1028,1047 ----
  	int res;
  
+ #ifdef Py_WIN_WIDE_FILENAMES
+ 	if (unicode_file_names()) {
+ 		PyUnicodeObject *po;
+ 		if (PyArg_ParseTuple(args, "Ui:access", &po, &mode)) {
+ 			Py_BEGIN_ALLOW_THREADS
+ 			/* PyUnicode_AS_UNICODE OK without thread lock as
+ 			   it is a simple dereference. */
+ 			res = _waccess(PyUnicode_AS_UNICODE(po), mode);
+ 			Py_END_ALLOW_THREADS
+ 			return(PyBool_FromLong(res == 0));
+ 		}
+ 		/* Drop the argument parsing error as narrow strings
+ 		   are also valid. */
+ 		PyErr_Clear();
+ 	}
+ #endif
  	if (!PyArg_ParseTuple(args, "si:access", &path, &mode))
  		return NULL;





More information about the Python-checkins mailing list