[Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.205,2.206 getargs.c,2.55,2.56

Mark Hammond mhammond@users.sourceforge.net
Sun, 13 May 2001 01:04:28 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv23512/Python

Modified Files:
	bltinmodule.c getargs.c 
Log Message:
Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system.  As discussed on python-dev and in patch 410465.

Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.205
retrieving revision 2.206
diff -C2 -r2.205 -r2.206
*** bltinmodule.c	2001/05/06 01:05:02	2.205
--- bltinmodule.c	2001/05/13 08:04:26	2.206
***************
*** 14,17 ****
--- 14,19 ----
  #endif
  
+ extern const char *Py_FileSystemDefaultEncoding;
+ 
  /* Forward */
  static PyObject *filterstring(PyObject *, PyObject *);
***************
*** 1531,1542 ****
  builtin_open(PyObject *self, PyObject *args)
  {
! 	char *name;
  	char *mode = "r";
  	int bufsize = -1;
  	PyObject *f;
  
! 	if (!PyArg_ParseTuple(args, "s|si:open", &name, &mode, &bufsize))
  		return NULL;
  	f = PyFile_FromString(name, mode);
  	if (f != NULL)
  		PyFile_SetBufSize(f, bufsize);
--- 1533,1546 ----
  builtin_open(PyObject *self, PyObject *args)
  {
! 	char *name = NULL;
  	char *mode = "r";
  	int bufsize = -1;
  	PyObject *f;
  
! 	if (!PyArg_ParseTuple(args, "et|si:open", Py_FileSystemDefaultEncoding, 
! 	                      &name, &mode, &bufsize))
  		return NULL;
  	f = PyFile_FromString(name, mode);
+ 	PyMem_Free(name); /* free the encoded string */
  	if (f != NULL)
  		PyFile_SetBufSize(f, bufsize);

Index: getargs.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v
retrieving revision 2.55
retrieving revision 2.56
diff -C2 -r2.55 -r2.56
*** getargs.c	2001/05/02 17:16:16	2.55
--- getargs.c	2001/05/13 08:04:26	2.56
***************
*** 699,703 ****
  			     't' (only recode non-string objects) 
  			*/
! 			if (*format != 's')
  			    	recode_strings = 1;
  			else if (*format == 't')
--- 699,703 ----
  			     't' (only recode non-string objects) 
  			*/
! 			if (*format == 's')
  			    	recode_strings = 1;
  			else if (*format == 't')