[Python-checkins] python/dist/src/Mac/Modules/file _Filemodule.c,1.17,1.18 filesupport.py,1.15,1.16

jackjansen@users.sourceforge.net jackjansen@users.sourceforge.net
Tue, 11 Mar 2003 13:49:00 -0800


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

Modified Files:
	_Filemodule.c filesupport.py 
Log Message:
Allow unicode pathnames where FSRefs are expected. Fixes 696253.


Index: _Filemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/file/_Filemodule.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** _Filemodule.c	2 Feb 2003 23:00:19 -0000	1.17
--- _Filemodule.c	11 Mar 2003 21:48:56 -0000	1.18
***************
*** 3223,3228 ****
  #if TARGET_API_MAC_OSX
  	/* On OSX we now try a pathname */
! 	if ( PyString_Check(v) ) {
! 		if ( (err=FSPathMakeRef(PyString_AsString(v), fsr, NULL)) ) {
  			PyMac_Error(err);
  			return 0;
--- 3223,3231 ----
  #if TARGET_API_MAC_OSX
  	/* On OSX we now try a pathname */
! 	if ( PyString_Check(v) || PyUnicode_Check(v)) {
! 		char *path = NULL;
! 		if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path))
! 			return NULL;
! 		if ( (err=FSPathMakeRef(path, fsr, NULL)) ) {
  			PyMac_Error(err);
  			return 0;

Index: filesupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/file/filesupport.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** filesupport.py	28 Jan 2003 23:29:46 -0000	1.15
--- filesupport.py	11 Mar 2003 21:48:57 -0000	1.16
***************
*** 281,286 ****
  #if TARGET_API_MAC_OSX
  	/* On OSX we now try a pathname */
! 	if ( PyString_Check(v) ) {
! 		if ( (err=FSPathMakeRef(PyString_AsString(v), fsr, NULL)) ) {
  			PyMac_Error(err);
  			return 0;
--- 281,289 ----
  #if TARGET_API_MAC_OSX
  	/* On OSX we now try a pathname */
! 	if ( PyString_Check(v) || PyUnicode_Check(v)) {
! 		char *path = NULL;
! 		if (!PyArg_Parse(v, "et", Py_FileSystemDefaultEncoding, &path))
! 			return NULL;
! 		if ( (err=FSPathMakeRef(path, fsr, NULL)) ) {
  			PyMac_Error(err);
  			return 0;