[Python-checkins] python/dist/src/Python bltinmodule.c,2.276,2.277

jvr@users.sourceforge.net jvr@users.sourceforge.net
Mon, 10 Feb 2003 01:22:04 -0800


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

Modified Files:
	bltinmodule.c 
Log Message:
My previous checkin caused compile() to no longer accept buffers, as noted
my MAL. Fixed. (Btw. eval() still doesn't take buffers, but that was so
even before my patch.)


Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.276
retrieving revision 2.277
diff -C2 -d -r2.276 -r2.277
*** bltinmodule.c	10 Feb 2003 08:21:07 -0000	2.276
--- bltinmodule.c	10 Feb 2003 09:22:01 -0000	2.277
***************
*** 19,22 ****
--- 19,24 ----
  #if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
  const char *Py_FileSystemDefaultEncoding = "mbcs";
+ #elif defined(__APPLE__)
+ const char *Py_FileSystemDefaultEncoding = "utf-8";
  #else
  const char *Py_FileSystemDefaultEncoding = NULL; /* use default */
***************
*** 342,345 ****
--- 344,348 ----
  	PyCompilerFlags cf;
  	PyObject *result, *cmd, *tmp = NULL;
+ 	int length;
  
  	if (!PyArg_ParseTuple(args, "Oss|ii:compile", &cmd, &filename,
***************
*** 358,369 ****
  	}
  #endif
! 	if (!PyString_Check(cmd)) {
  		PyErr_SetString(PyExc_TypeError,
! 				"compile() arg 1 must be a string");
  		return NULL;
  	}
- 
- 	if (PyString_AsStringAndSize(cmd, &str, NULL))
- 		return NULL;
  
  	if (strcmp(startstr, "exec") == 0)
--- 361,371 ----
  	}
  #endif
! 	if (PyObject_AsReadBuffer(cmd, (const void **)&str, &length))
! 		return NULL;
! 	if (length != strlen(str)) {
  		PyErr_SetString(PyExc_TypeError,
! 				"expected string without null bytes");
  		return NULL;
  	}
  
  	if (strcmp(startstr, "exec") == 0)