[Python-3000-checkins] r65582 - in python/branches/py3k: Include/object.h Include/unicodeobject.h Misc/NEWS Modules/_ctypes/_ctypes.c Modules/_ctypes/callproc.c Modules/_ctypes/stgdict.c Modules/_elementtree.c Modules/_gestalt.c Modules/_hashopenssl.c Modules/_lsprof.c Modules/_pickle.c Modules/_sqlite/connection.c Modules/_sqlite/cursor.c Modules/_sqlite/row.c Modules/_sqlite/statement.c Modules/_ssl.c Modules/_struct.c Modules/_testcapimodule.c Modules/_tkinter.c Modules/cjkcodecs/cjkcodecs.h Modules/cjkcodecs/multibytecodec.c Modules/datetimemodule.c Modules/grpmodule.c Modules/operator.c Modules/ossaudiodev.c Modules/parsermodule.c Modules/posixmodule.c Modules/pyexpat.c Modules/readline.c Modules/socketmodule.c Modules/syslogmodule.c Modules/timemodule.c Modules/zipimport.c Objects/bytesobject.c Objects/codeobject.c Objects/exceptions.c Objects/floatobject.c Objects/funcobject.c Objects/moduleobject.c Objects/object.c Objects/setobject.c Objects/structseq.c Objects/typeobject.c Objects/unicodeobject.c Objects/weakrefobject.c Parser/tokenizer.c Python/_warnings.c Python/ast.c Python/bltinmodule.c Python/ceval.c Python/compile.c Python/errors.c Python/future.c Python/getargs.c Python/import.c Python/peephole.c Python/pythonrun.c Python/structmember.c Python/symtable.c Python/traceback.c

marc-andre.lemburg python-3000-checkins at python.org
Thu Aug 7 20:54:36 CEST 2008


Author: marc-andre.lemburg
Date: Thu Aug  7 20:54:33 2008
New Revision: 65582

Log:
Rename PyUnicode_AsString -> _PyUnicode_AsString and
PyUnicode_AsStringAndSize -> _PyUnicode_AsStringAndSize to mark
them for interpreter internal use only.

We'll have to rework these APIs or create new ones for the
purpose of accessing the UTF-8 representation of Unicode objects
for 3.1.



Modified:
   python/branches/py3k/Include/object.h
   python/branches/py3k/Include/unicodeobject.h
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Modules/_ctypes/_ctypes.c
   python/branches/py3k/Modules/_ctypes/callproc.c
   python/branches/py3k/Modules/_ctypes/stgdict.c
   python/branches/py3k/Modules/_elementtree.c
   python/branches/py3k/Modules/_gestalt.c
   python/branches/py3k/Modules/_hashopenssl.c
   python/branches/py3k/Modules/_lsprof.c
   python/branches/py3k/Modules/_pickle.c
   python/branches/py3k/Modules/_sqlite/connection.c
   python/branches/py3k/Modules/_sqlite/cursor.c
   python/branches/py3k/Modules/_sqlite/row.c
   python/branches/py3k/Modules/_sqlite/statement.c
   python/branches/py3k/Modules/_ssl.c
   python/branches/py3k/Modules/_struct.c
   python/branches/py3k/Modules/_testcapimodule.c
   python/branches/py3k/Modules/_tkinter.c
   python/branches/py3k/Modules/cjkcodecs/cjkcodecs.h
   python/branches/py3k/Modules/cjkcodecs/multibytecodec.c
   python/branches/py3k/Modules/datetimemodule.c
   python/branches/py3k/Modules/grpmodule.c
   python/branches/py3k/Modules/operator.c
   python/branches/py3k/Modules/ossaudiodev.c
   python/branches/py3k/Modules/parsermodule.c
   python/branches/py3k/Modules/posixmodule.c
   python/branches/py3k/Modules/pyexpat.c
   python/branches/py3k/Modules/readline.c
   python/branches/py3k/Modules/socketmodule.c
   python/branches/py3k/Modules/syslogmodule.c
   python/branches/py3k/Modules/timemodule.c
   python/branches/py3k/Modules/zipimport.c
   python/branches/py3k/Objects/bytesobject.c
   python/branches/py3k/Objects/codeobject.c
   python/branches/py3k/Objects/exceptions.c
   python/branches/py3k/Objects/floatobject.c
   python/branches/py3k/Objects/funcobject.c
   python/branches/py3k/Objects/moduleobject.c
   python/branches/py3k/Objects/object.c
   python/branches/py3k/Objects/setobject.c
   python/branches/py3k/Objects/structseq.c
   python/branches/py3k/Objects/typeobject.c
   python/branches/py3k/Objects/unicodeobject.c
   python/branches/py3k/Objects/weakrefobject.c
   python/branches/py3k/Parser/tokenizer.c
   python/branches/py3k/Python/_warnings.c
   python/branches/py3k/Python/ast.c
   python/branches/py3k/Python/bltinmodule.c
   python/branches/py3k/Python/ceval.c
   python/branches/py3k/Python/compile.c
   python/branches/py3k/Python/errors.c
   python/branches/py3k/Python/future.c
   python/branches/py3k/Python/getargs.c
   python/branches/py3k/Python/import.c
   python/branches/py3k/Python/peephole.c
   python/branches/py3k/Python/pythonrun.c
   python/branches/py3k/Python/structmember.c
   python/branches/py3k/Python/symtable.c
   python/branches/py3k/Python/traceback.c

Modified: python/branches/py3k/Include/object.h
==============================================================================
--- python/branches/py3k/Include/object.h	(original)
+++ python/branches/py3k/Include/object.h	Thu Aug  7 20:54:33 2008
@@ -466,7 +466,7 @@
 PyAPI_FUNC(long) _Py_HashPointer(void*);
 
 /* Helper for passing objects to printf and the like */
-#define PyObject_REPR(obj) PyUnicode_AsString(PyObject_Repr(obj))
+#define PyObject_REPR(obj) _PyUnicode_AsString(PyObject_Repr(obj))
 
 /* Flag bits for printing: */
 #define Py_PRINT_RAW	1	/* No string quotes etc. */

Modified: python/branches/py3k/Include/unicodeobject.h
==============================================================================
--- python/branches/py3k/Include/unicodeobject.h	(original)
+++ python/branches/py3k/Include/unicodeobject.h	Thu Aug  7 20:54:33 2008
@@ -704,9 +704,15 @@
 
    In case of an error, no *size is set.
 
+   *** This API is for interpreter INTERNAL USE ONLY and will likely
+   *** be removed or changed for Python 3.1.
+
+   *** If you need to access the Unicode object as UTF-8 bytes string,
+   *** please use PyUnicode_AsUTF8String() instead.
+
 */
 
-PyAPI_FUNC(char *) PyUnicode_AsStringAndSize(
+PyAPI_FUNC(char *) _PyUnicode_AsStringAndSize(
     PyObject *unicode, 
     Py_ssize_t *size);
 
@@ -714,12 +720,17 @@
    Unicode object unicode.
 
    Use of this API is DEPRECATED since no size information can be
-   extracted from the returned data. Use PyUnicode_AsStringAndSize()
-   instead.
+   extracted from the returned data.
+
+   *** This API is for interpreter INTERNAL USE ONLY and will likely
+   *** be removed or changed for Python 3.1.
+
+   *** If you need to access the Unicode object as UTF-8 bytes string,
+   *** please use PyUnicode_AsUTF8String() instead.
 
 */
 
-PyAPI_FUNC(char *) PyUnicode_AsString(PyObject *unicode);
+PyAPI_FUNC(char *) _PyUnicode_AsString(PyObject *unicode);
 
 /* Returns the currently active default encoding.
 

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Thu Aug  7 20:54:33 2008
@@ -15,6 +15,14 @@
 - Issue #1819: function calls with several named parameters are now on
   average 35% faster (as measured by pybench).
 
+- The undocumented C APIs PyUnicode_AsString() and
+  PyUnicode_AsStringAndSize() were made private to the interpreter, in
+  order to be able to refine their interfaces for Python 3.1.
+
+  If you need to access the UTF-8 representation of a Unicode object
+  as bytes string, please use PyUnicode_AsUTF8String() instead.
+
+
 Library
 -------
 

Modified: python/branches/py3k/Modules/_ctypes/_ctypes.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/_ctypes.c	(original)
+++ python/branches/py3k/Modules/_ctypes/_ctypes.c	Thu Aug  7 20:54:33 2008
@@ -683,8 +683,8 @@
 		return -1;
 	
 	if (value && PyUnicode_Check(key) &&
-	    /* XXX struni PyUnicode_AsString can fail (also in other places)! */
-	    0 == strcmp(PyUnicode_AsString(key), "_fields_"))
+	    /* XXX struni _PyUnicode_AsString can fail (also in other places)! */
+	    0 == strcmp(_PyUnicode_AsString(key), "_fields_"))
 		return StructUnionType_update_stgdict(self, value, 1);
 	return 0;
 }
@@ -698,7 +698,7 @@
 		return -1;
 	
 	if (PyUnicode_Check(key) &&
-	    0 == strcmp(PyUnicode_AsString(key), "_fields_"))
+	    0 == strcmp(_PyUnicode_AsString(key), "_fields_"))
 		return StructUnionType_update_stgdict(self, value, 0);
 	return 0;
 }
@@ -1681,7 +1681,7 @@
 	if (stgd && CDataObject_Check(value) && stgd->proto && PyUnicode_Check(stgd->proto)) {
 		PyCArgObject *parg;
 
-		switch (PyUnicode_AsString(stgd->proto)[0]) {
+		switch (_PyUnicode_AsString(stgd->proto)[0]) {
 		case 'z': /* c_char_p */
 		case 'Z': /* c_wchar_p */
 			parg = new_CArgObject();
@@ -1791,7 +1791,7 @@
 	
 	dict = PyObject_stgdict((PyObject *)self);
 	assert(dict); /* Cannot be NULL for CDataObject instances */
-	fmt = PyUnicode_AsString(dict->proto);
+	fmt = _PyUnicode_AsString(dict->proto);
 	assert(fmt);
 
 	fd = getentry(fmt);
@@ -2012,7 +2012,7 @@
 	assert(dict);
 
 	/* I think we can rely on this being a one-character string */
-	fmt = PyUnicode_AsString(dict->proto);
+	fmt = _PyUnicode_AsString(dict->proto);
 	assert(fmt);
 	
 	fd = getentry(fmt);
@@ -3058,7 +3058,7 @@
 	    /* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */
 	    && PyUnicode_Check(dict->proto)
 /* We only allow c_void_p, c_char_p and c_wchar_p as a simple output parameter type */
-	    && (strchr("PzZ", PyUnicode_AsString(dict->proto)[0]))) {
+	    && (strchr("PzZ", _PyUnicode_AsString(dict->proto)[0]))) {
 		return 1;
 	}
 
@@ -3148,7 +3148,7 @@
 		return *pname ? 1 : 0;
 	}
 	if (PyUnicode_Check(obj)) {
-		*pname = PyUnicode_AsString(obj);
+		*pname = _PyUnicode_AsString(obj);
 		return *pname ? 1 : 0;
 	}
 	PyErr_SetString(PyExc_TypeError,
@@ -5127,7 +5127,7 @@
 	dict = PyType_stgdict(arg);
 	if (dict) {
 		if (PyUnicode_Check(dict->proto)
-		    && (strchr("sPzUZXO", PyUnicode_AsString(dict->proto)[0]))) {
+		    && (strchr("sPzUZXO", _PyUnicode_AsString(dict->proto)[0]))) {
 			/* simple pointer types, c_void_p, c_wchar_p, BSTR, ... */
 			return 1;
 		}

Modified: python/branches/py3k/Modules/_ctypes/callproc.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/callproc.c	(original)
+++ python/branches/py3k/Modules/_ctypes/callproc.c	Thu Aug  7 20:54:33 2008
@@ -1750,7 +1750,7 @@
 		return result;
 	}
 	if (PyUnicode_CheckExact(cls)) {
-		char *name = PyUnicode_AsString(cls);
+		char *name = _PyUnicode_AsString(cls);
 		buf = alloca(strlen(name) + 3 + 1);
 		sprintf(buf, "LP_%s", name);
 		result = PyObject_CallFunction((PyObject *)Py_TYPE(&Pointer_Type),

Modified: python/branches/py3k/Modules/_ctypes/stgdict.c
==============================================================================
--- python/branches/py3k/Modules/_ctypes/stgdict.c	(original)
+++ python/branches/py3k/Modules/_ctypes/stgdict.c	Thu Aug  7 20:54:33 2008
@@ -479,7 +479,7 @@
 			bitsize = 0;
 		if (isStruct && !isPacked) {
 			char *fieldfmt = dict->format ? dict->format : "B";
-			char *fieldname = PyUnicode_AsString(name);
+			char *fieldname = _PyUnicode_AsString(name);
 			char *ptr;
 			Py_ssize_t len = strlen(fieldname) + strlen(fieldfmt);
 			char *buf = alloca(len + 2 + 1);

Modified: python/branches/py3k/Modules/_elementtree.c
==============================================================================
--- python/branches/py3k/Modules/_elementtree.c	(original)
+++ python/branches/py3k/Modules/_elementtree.c	Thu Aug  7 20:54:33 2008
@@ -1303,7 +1303,7 @@
     char *name = "";
 
     if (PyUnicode_Check(nameobj))
-	name = PyUnicode_AsString(nameobj);
+	name = _PyUnicode_AsString(nameobj);
 
     if (strcmp(name, "tag") == 0)
 	res = self->tag;
@@ -2529,7 +2529,7 @@
     char *name = "";
 
     if (PyUnicode_Check(nameobj))
-	name = PyUnicode_AsString(nameobj);
+	name = _PyUnicode_AsString(nameobj);
 
     PyErr_Clear();
 

Modified: python/branches/py3k/Modules/_gestalt.c
==============================================================================
--- python/branches/py3k/Modules/_gestalt.c	(original)
+++ python/branches/py3k/Modules/_gestalt.c	Thu Aug  7 20:54:33 2008
@@ -38,7 +38,7 @@
 			"OSType arg must be string of 4 chars");
         return 0;
     }
-    memcpy((char *)&tmp, PyUnicode_AsString(v), 4);
+    memcpy((char *)&tmp, _PyUnicode_AsString(v), 4);
     *pr = (OSType)ntohl(tmp);
     return 1;
 }

Modified: python/branches/py3k/Modules/_hashopenssl.c
==============================================================================
--- python/branches/py3k/Modules/_hashopenssl.c	(original)
+++ python/branches/py3k/Modules/_hashopenssl.c	Thu Aug  7 20:54:33 2008
@@ -241,7 +241,7 @@
 {
     char buf[100];
     PyOS_snprintf(buf, sizeof(buf), "<%s HASH object @ %p>",
-            PyUnicode_AsString(((EVPobject *)self)->name), self);
+            _PyUnicode_AsString(((EVPobject *)self)->name), self);
     return PyUnicode_FromString(buf);
 }
 

Modified: python/branches/py3k/Modules/_lsprof.c
==============================================================================
--- python/branches/py3k/Modules/_lsprof.c	(original)
+++ python/branches/py3k/Modules/_lsprof.c	Thu Aug  7 20:54:33 2008
@@ -180,7 +180,7 @@
 		PyObject *mod = fn->m_module;
 		const char *modname;
 		if (mod && PyUnicode_Check(mod)) {
-			modname = PyUnicode_AsString(mod);
+			modname = _PyUnicode_AsString(mod);
 		}
 		else if (mod && PyModule_Check(mod)) {
 			modname = PyModule_GetName(mod);

Modified: python/branches/py3k/Modules/_pickle.c
==============================================================================
--- python/branches/py3k/Modules/_pickle.c	(original)
+++ python/branches/py3k/Modules/_pickle.c	Thu Aug  7 20:54:33 2008
@@ -927,7 +927,7 @@
         repr = PyUnicode_FromStringAndSize(NULL, (int)nbytes);
         if (repr == NULL)
             goto error;
-        pdata = (unsigned char *)PyUnicode_AsString(repr);
+        pdata = (unsigned char *)_PyUnicode_AsString(repr);
         i = _PyLong_AsByteArray((PyLongObject *)obj,
                                 pdata, nbytes,
                                 1 /* little endian */ , 1 /* signed */ );
@@ -972,7 +972,7 @@
         if (repr == NULL)
             goto error;
 
-        string = PyUnicode_AsStringAndSize(repr, &size);
+        string = _PyUnicode_AsStringAndSize(repr, &size);
         if (string == NULL)
             goto error;
 
@@ -1869,7 +1869,7 @@
             /* XXX: Should it check whether the persistent id only contains
                ASCII characters? And what if the pid contains embedded
                newlines? */
-            pid_ascii_bytes = PyUnicode_AsStringAndSize(pid_str, &size);
+            pid_ascii_bytes = _PyUnicode_AsStringAndSize(pid_str, &size);
             Py_DECREF(pid_str);
             if (pid_ascii_bytes == NULL)
                 goto error;

Modified: python/branches/py3k/Modules/_sqlite/connection.c
==============================================================================
--- python/branches/py3k/Modules/_sqlite/connection.c	(original)
+++ python/branches/py3k/Modules/_sqlite/connection.c	Thu Aug  7 20:54:33 2008
@@ -434,7 +434,7 @@
     } else if (PyFloat_Check(py_val)) {
         sqlite3_result_double(context, PyFloat_AsDouble(py_val));
     } else if (PyUnicode_Check(py_val)) {
-        sqlite3_result_text(context, PyUnicode_AsString(py_val), -1, SQLITE_TRANSIENT);
+        sqlite3_result_text(context, _PyUnicode_AsString(py_val), -1, SQLITE_TRANSIENT);
     } else if (PyObject_CheckBuffer(py_val)) {
         if (PyObject_AsCharBuffer(py_val, &buffer, &buflen) != 0) {
             PyErr_SetString(PyExc_ValueError, "could not convert BLOB to buffer");
@@ -901,7 +901,7 @@
             return -1;
         }
 
-        statement = PyUnicode_AsStringAndSize(begin_statement, &size);
+        statement = _PyUnicode_AsStringAndSize(begin_statement, &size);
         if (!statement) {
             Py_DECREF(statement);
             return -1;
@@ -1194,7 +1194,7 @@
         goto finally;
     }
 
-    chk = PyUnicode_AsString(uppercase_name);
+    chk = _PyUnicode_AsString(uppercase_name);
     while (*chk) {
         if ((*chk >= '0' && *chk <= '9')
          || (*chk >= 'A' && *chk <= 'Z')
@@ -1219,7 +1219,7 @@
     }
 
     rc = sqlite3_create_collation(self->db,
-                                  PyUnicode_AsString(uppercase_name),
+                                  _PyUnicode_AsString(uppercase_name),
                                   SQLITE_UTF8,
                                   (callable != Py_None) ? callable : NULL,
                                   (callable != Py_None) ? pysqlite_collation_callback : NULL);

Modified: python/branches/py3k/Modules/_sqlite/cursor.c
==============================================================================
--- python/branches/py3k/Modules/_sqlite/cursor.c	(original)
+++ python/branches/py3k/Modules/_sqlite/cursor.c	Thu Aug  7 20:54:33 2008
@@ -490,7 +490,7 @@
         rc = pysqlite_statement_reset(self->statement);
     }
 
-    operation_cstr = PyUnicode_AsStringAndSize(operation, &operation_len);
+    operation_cstr = _PyUnicode_AsStringAndSize(operation, &operation_len);
     if (operation == NULL)
         goto error;
 
@@ -793,7 +793,7 @@
     }
 
     if (PyUnicode_Check(script_obj)) {
-        script_cstr = PyUnicode_AsString(script_obj);
+        script_cstr = _PyUnicode_AsString(script_obj);
         if (!script_cstr) {
             return NULL;
         }

Modified: python/branches/py3k/Modules/_sqlite/row.c
==============================================================================
--- python/branches/py3k/Modules/_sqlite/row.c	(original)
+++ python/branches/py3k/Modules/_sqlite/row.c	Thu Aug  7 20:54:33 2008
@@ -82,12 +82,12 @@
         Py_XINCREF(item);
         return item;
     } else if (PyUnicode_Check(idx)) {
-        key = PyUnicode_AsString(idx);
+        key = _PyUnicode_AsString(idx);
 
         nitems = PyTuple_Size(self->description);
 
         for (i = 0; i < nitems; i++) {
-            compare_key = PyUnicode_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0));
+            compare_key = _PyUnicode_AsString(PyTuple_GET_ITEM(PyTuple_GET_ITEM(self->description, i), 0));
             if (!compare_key) {
                 return NULL;
             }

Modified: python/branches/py3k/Modules/_sqlite/statement.c
==============================================================================
--- python/branches/py3k/Modules/_sqlite/statement.c	(original)
+++ python/branches/py3k/Modules/_sqlite/statement.c	Thu Aug  7 20:54:33 2008
@@ -59,7 +59,7 @@
     self->st = NULL;
     self->in_use = 0;
 
-    sql_cstr = PyUnicode_AsStringAndSize(sql, &sql_cstr_len);
+    sql_cstr = _PyUnicode_AsStringAndSize(sql, &sql_cstr_len);
     if (sql_cstr == NULL) {
         rc = PYSQLITE_SQL_WRONG_TYPE;
         return rc;
@@ -140,7 +140,7 @@
             rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter));
             break;
         case TYPE_UNICODE:
-            string = PyUnicode_AsString(parameter);
+            string = _PyUnicode_AsString(parameter);
             rc = sqlite3_bind_text(self->st, pos, string, -1, SQLITE_TRANSIENT);
             break;
         case TYPE_BUFFER:
@@ -296,7 +296,7 @@
     Py_ssize_t sql_len;
     sqlite3_stmt* new_st;
 
-    sql_cstr = PyUnicode_AsStringAndSize(self->sql, &sql_len);
+    sql_cstr = _PyUnicode_AsStringAndSize(self->sql, &sql_len);
     if (sql_cstr == NULL) {
         rc = PYSQLITE_SQL_WRONG_TYPE;
         return rc;

Modified: python/branches/py3k/Modules/_ssl.c
==============================================================================
--- python/branches/py3k/Modules/_ssl.c	(original)
+++ python/branches/py3k/Modules/_ssl.c	Thu Aug  7 20:54:33 2008
@@ -1461,7 +1461,7 @@
 	return PyErr_Format(PyExc_TypeError,
 			    "RAND_egd() expected string, found %s",
 			    Py_TYPE(arg)->tp_name);
-    bytes = RAND_egd(PyUnicode_AsString(arg));
+    bytes = RAND_egd(_PyUnicode_AsString(arg));
     if (bytes == -1) {
 	PyErr_SetString(PySSLErrorObject,
 			"EGD connection failed or EGD did not return "

Modified: python/branches/py3k/Modules/_struct.c
==============================================================================
--- python/branches/py3k/Modules/_struct.c	(original)
+++ python/branches/py3k/Modules/_struct.c	Thu Aug  7 20:54:33 2008
@@ -406,7 +406,7 @@
 		if (msg == NULL)
 			return -1;
 		rval = PyErr_WarnEx(PyExc_DeprecationWarning,
-				    PyUnicode_AsString(msg), 2);
+				    _PyUnicode_AsString(msg), 2);
 		Py_DECREF(msg);
 		if (rval == 0)
 			return 0;

Modified: python/branches/py3k/Modules/_testcapimodule.c
==============================================================================
--- python/branches/py3k/Modules/_testcapimodule.c	(original)
+++ python/branches/py3k/Modules/_testcapimodule.c	Thu Aug  7 20:54:33 2008
@@ -788,7 +788,7 @@
 	result = PyUnicode_FromFormat(FORMAT, (TYPE)1);	\
 	if (result == NULL)				\
 		return NULL;				\
-	if (strcmp(PyUnicode_AsString(result), "1")) {	\
+	if (strcmp(_PyUnicode_AsString(result), "1")) {	\
 		msg = FORMAT " failed at 1";		\
 		goto Fail;				\
 	}						\

Modified: python/branches/py3k/Modules/_tkinter.c
==============================================================================
--- python/branches/py3k/Modules/_tkinter.c	(original)
+++ python/branches/py3k/Modules/_tkinter.c	Thu Aug  7 20:54:33 2008
@@ -1424,7 +1424,7 @@
 		return 1;
 	}
         if (PyUnicode_Check(in)) {
-		*out = PyUnicode_AsString(in);
+		*out = _PyUnicode_AsString(in);
 		return 1;
 	}
 	if (PyTclObject_Check(in)) {

Modified: python/branches/py3k/Modules/cjkcodecs/cjkcodecs.h
==============================================================================
--- python/branches/py3k/Modules/cjkcodecs/cjkcodecs.h	(original)
+++ python/branches/py3k/Modules/cjkcodecs/cjkcodecs.h	Thu Aug  7 20:54:33 2008
@@ -266,7 +266,7 @@
 				"encoding name must be a string.");
 		return NULL;
 	}
-	enc = PyUnicode_AsString(encoding);
+	enc = _PyUnicode_AsString(encoding);
 	if (enc == NULL)
 		return NULL;
 

Modified: python/branches/py3k/Modules/cjkcodecs/multibytecodec.c
==============================================================================
--- python/branches/py3k/Modules/cjkcodecs/multibytecodec.c	(original)
+++ python/branches/py3k/Modules/cjkcodecs/multibytecodec.c	Thu Aug  7 20:54:33 2008
@@ -95,7 +95,7 @@
 	const char *str;
 
 	assert(PyUnicode_Check(errors));
-	str = PyUnicode_AsString(errors);
+	str = _PyUnicode_AsString(errors);
 	if (str == NULL)
 		return NULL;
 	cb = PyCodec_LookupError(str);
@@ -148,7 +148,7 @@
 		return -1;
 	}
 
-	str = PyUnicode_AsString(value);
+	str = _PyUnicode_AsString(value);
 	if (str == NULL)
 		return -1;
 

Modified: python/branches/py3k/Modules/datetimemodule.c
==============================================================================
--- python/branches/py3k/Modules/datetimemodule.c	(original)
+++ python/branches/py3k/Modules/datetimemodule.c	Thu Aug  7 20:54:33 2008
@@ -1219,7 +1219,7 @@
 	assert(object && format && timetuple);
 	assert(PyUnicode_Check(format));
 	/* Convert the input format to a C string and size */
-	pin = PyUnicode_AsStringAndSize(format, &flen);
+	pin = _PyUnicode_AsStringAndSize(format, &flen);
 	if (!pin)
 		return NULL;
 
@@ -1312,7 +1312,7 @@
 			}
 			assert(Zreplacement != NULL);
 			assert(PyUnicode_Check(Zreplacement));
-			ptoappend = PyUnicode_AsStringAndSize(Zreplacement,
+			ptoappend = _PyUnicode_AsStringAndSize(Zreplacement,
                                                               &ntoappend);
 			ntoappend = Py_SIZE(Zreplacement);
 		}

Modified: python/branches/py3k/Modules/grpmodule.c
==============================================================================
--- python/branches/py3k/Modules/grpmodule.c	(original)
+++ python/branches/py3k/Modules/grpmodule.c	Thu Aug  7 20:54:33 2008
@@ -113,7 +113,7 @@
     py_str_name = PyObject_Str(pyo_name);
     if (!py_str_name)
 	    return NULL;
-    name = PyUnicode_AsString(py_str_name);
+    name = _PyUnicode_AsString(py_str_name);
     
     if ((p = getgrnam(name)) == NULL) {
 	PyErr_Format(PyExc_KeyError, "getgrnam(): name not found: %s", name);

Modified: python/branches/py3k/Modules/operator.c
==============================================================================
--- python/branches/py3k/Modules/operator.c	(original)
+++ python/branches/py3k/Modules/operator.c	Thu Aug  7 20:54:33 2008
@@ -449,7 +449,7 @@
 		return NULL;
 	}
 
-	s = PyUnicode_AsString(attr);
+	s = _PyUnicode_AsString(attr);
 	Py_INCREF(obj);
 	for (;;) {
 		PyObject *newobj, *str;

Modified: python/branches/py3k/Modules/ossaudiodev.c
==============================================================================
--- python/branches/py3k/Modules/ossaudiodev.c	(original)
+++ python/branches/py3k/Modules/ossaudiodev.c	Thu Aug  7 20:54:33 2008
@@ -809,7 +809,7 @@
     PyObject * rval = NULL;
 
     if (PyUnicode_Check(nameobj))
-	name = PyUnicode_AsString(nameobj);
+	name = _PyUnicode_AsString(nameobj);
     
     if (strcmp(name, "closed") == 0) {
         rval = (self->fd == -1) ? Py_True : Py_False;

Modified: python/branches/py3k/Modules/parsermodule.c
==============================================================================
--- python/branches/py3k/Modules/parsermodule.c	(original)
+++ python/branches/py3k/Modules/parsermodule.c	Thu Aug  7 20:54:33 2008
@@ -718,7 +718,7 @@
                     Py_DECREF(o);
                 }
             }
-            temp_str = PyUnicode_AsStringAndSize(temp, &len);
+            temp_str = _PyUnicode_AsStringAndSize(temp, &len);
             strn = (char *)PyObject_MALLOC(len + 1);
             if (strn != NULL)
                 (void) memcpy(strn, temp_str, len + 1);
@@ -807,7 +807,7 @@
             if (res && encoding) {
                 Py_ssize_t len;
                 const char *temp;
-                temp = PyUnicode_AsStringAndSize(encoding, &len);
+                temp = _PyUnicode_AsStringAndSize(encoding, &len);
                 res->n_str = (char *)PyObject_MALLOC(len + 1);
                 if (res->n_str != NULL && temp != NULL)
                     (void) memcpy(res->n_str, temp, len + 1);

Modified: python/branches/py3k/Modules/posixmodule.c
==============================================================================
--- python/branches/py3k/Modules/posixmodule.c	(original)
+++ python/branches/py3k/Modules/posixmodule.c	Thu Aug  7 20:54:33 2008
@@ -5566,7 +5566,7 @@
                             "configuration names must be strings or integers");
             return 0;
         }
-        confname = PyUnicode_AsString(arg);
+        confname = _PyUnicode_AsString(arg);
         if (confname == NULL)
             return 0;
         while (lo < hi) {
@@ -5897,7 +5897,7 @@
 	    if ((unsigned int)len >= sizeof(buffer)) {
                 result = PyUnicode_FromStringAndSize(NULL, len-1);
                 if (result != NULL)
-                    confstr(name, PyUnicode_AsString(result), len);
+                    confstr(name, _PyUnicode_AsString(result), len);
             }
             else
                 result = PyUnicode_FromStringAndSize(buffer, len-1);

Modified: python/branches/py3k/Modules/pyexpat.c
==============================================================================
--- python/branches/py3k/Modules/pyexpat.c	(original)
+++ python/branches/py3k/Modules/pyexpat.c	Thu Aug  7 20:54:33 2008
@@ -1338,7 +1338,7 @@
     int handlernum = -1;
 
     if (PyUnicode_Check(nameobj))
-	name = PyUnicode_AsString(nameobj);
+	name = _PyUnicode_AsString(nameobj);
     
     handlernum = handlername2int(name);
 

Modified: python/branches/py3k/Modules/readline.c
==============================================================================
--- python/branches/py3k/Modules/readline.c	(original)
+++ python/branches/py3k/Modules/readline.c	Thu Aug  7 20:54:33 2008
@@ -724,7 +724,7 @@
 			result = NULL;
 		}
 		else {
-			char *s = PyUnicode_AsString(r);
+			char *s = _PyUnicode_AsString(r);
 			if (s == NULL)
 				goto error;
 			result = strdup(s);

Modified: python/branches/py3k/Modules/socketmodule.c
==============================================================================
--- python/branches/py3k/Modules/socketmodule.c	(original)
+++ python/branches/py3k/Modules/socketmodule.c	Thu Aug  7 20:54:33 2008
@@ -3744,7 +3744,7 @@
 		PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", value);
 		pptr = pbuf;
 	} else if (PyUnicode_Check(pobj)) {
-		pptr = PyUnicode_AsString(pobj);
+		pptr = _PyUnicode_AsString(pobj);
 	} else if (PyBytes_Check(pobj)) {
 		pptr = PyBytes_AsString(pobj);
 	} else if (pobj == Py_None) {

Modified: python/branches/py3k/Modules/syslogmodule.c
==============================================================================
--- python/branches/py3k/Modules/syslogmodule.c	(original)
+++ python/branches/py3k/Modules/syslogmodule.c	Thu Aug  7 20:54:33 2008
@@ -72,7 +72,7 @@
 	S_ident_o = new_S_ident_o;
 	Py_INCREF(S_ident_o);
 
-	ident = PyUnicode_AsString(S_ident_o);
+	ident = _PyUnicode_AsString(S_ident_o);
 	if (ident == NULL)
 		return NULL;
 	openlog(ident, logopt, facility);
@@ -97,7 +97,7 @@
 			return NULL;
 	}
 
-	message = PyUnicode_AsString(message_object);
+	message = _PyUnicode_AsString(message_object);
 	if (message == NULL)
 		return NULL;
 	Py_BEGIN_ALLOW_THREADS;

Modified: python/branches/py3k/Modules/timemodule.c
==============================================================================
--- python/branches/py3k/Modules/timemodule.c	(original)
+++ python/branches/py3k/Modules/timemodule.c	Thu Aug  7 20:54:33 2008
@@ -509,7 +509,7 @@
         }
 
     /* Convert the unicode string to an ascii one */
-    fmt = PyUnicode_AsString(format);
+    fmt = _PyUnicode_AsString(format);
 
 	fmtlen = strlen(fmt);
 

Modified: python/branches/py3k/Modules/zipimport.c
==============================================================================
--- python/branches/py3k/Modules/zipimport.c	(original)
+++ python/branches/py3k/Modules/zipimport.c	Thu Aug  7 20:54:33 2008
@@ -180,9 +180,9 @@
 	char *prefix = "";
 
 	if (self->archive != NULL && PyUnicode_Check(self->archive))
-		archive = PyUnicode_AsString(self->archive);
+		archive = _PyUnicode_AsString(self->archive);
 	if (self->prefix != NULL && PyUnicode_Check(self->prefix))
-		prefix = PyUnicode_AsString(self->prefix);
+		prefix = _PyUnicode_AsString(self->prefix);
 	if (prefix != NULL && *prefix)
 		return PyUnicode_FromFormat("<zipimporter object \"%.300s%c%.150s\">",
 		                            archive, SEP, prefix);
@@ -248,7 +248,7 @@
 
 	subname = get_subname(fullname);
 
-	len = make_filename(PyUnicode_AsString(self->prefix), subname, path);
+	len = make_filename(_PyUnicode_AsString(self->prefix), subname, path);
 	if (len < 0)
 		return MI_ERROR;
 
@@ -321,12 +321,12 @@
 		/* add __path__ to the module *before* the code gets
 		   executed */
 		PyObject *pkgpath, *fullpath;
-		char *prefix = PyUnicode_AsString(self->prefix);
+		char *prefix = _PyUnicode_AsString(self->prefix);
 		char *subname = get_subname(fullname);
 		int err;
 
 		fullpath = PyUnicode_FromFormat("%s%c%s%s",
-					PyUnicode_AsString(self->archive),
+					_PyUnicode_AsString(self->archive),
 					SEP,
 					prefix ? prefix : "",
 					subname);
@@ -404,7 +404,7 @@
 	}
 	path = buf;
 #endif
-	archive_str = PyUnicode_AsStringAndSize(self->archive, &len);
+	archive_str = _PyUnicode_AsStringAndSize(self->archive, &len);
 	if ((size_t)len < strlen(path) &&
 	    strncmp(path, archive_str, len) == 0 &&
 	    path[len] == SEP) {
@@ -453,7 +453,7 @@
 	}
 	subname = get_subname(fullname);
 
-	len = make_filename(PyUnicode_AsString(self->prefix), subname, path);
+	len = make_filename(_PyUnicode_AsString(self->prefix), subname, path);
 	if (len < 0)
 		return NULL;
 
@@ -466,7 +466,7 @@
 
 	toc_entry = PyDict_GetItemString(self->files, path);
 	if (toc_entry != NULL) {
-		PyObject *bytes = get_data(PyUnicode_AsString(self->archive), toc_entry);
+		PyObject *bytes = get_data(_PyUnicode_AsString(self->archive), toc_entry);
 		PyObject *res = PyUnicode_FromString(PyByteArray_AsString(bytes));
 		Py_XDECREF(bytes);
 		return res;
@@ -1053,7 +1053,7 @@
 {
 	PyObject *data, *code;
 	char *modpath;
-	char *archive = PyUnicode_AsString(self->archive);
+	char *archive = _PyUnicode_AsString(self->archive);
 
 	if (archive == NULL)
 		return NULL;
@@ -1062,7 +1062,7 @@
 	if (data == NULL)
 		return NULL;
 
-	modpath = PyUnicode_AsString(PyTuple_GetItem(toc_entry, 0));
+	modpath = _PyUnicode_AsString(PyTuple_GetItem(toc_entry, 0));
 
 	if (isbytecode) {
 		code = unmarshal_code(modpath, data, mtime);
@@ -1087,7 +1087,7 @@
 
 	subname = get_subname(fullname);
 
-	len = make_filename(PyUnicode_AsString(self->prefix), subname, path);
+	len = make_filename(_PyUnicode_AsString(self->prefix), subname, path);
 	if (len < 0)
 		return NULL;
 
@@ -1097,7 +1097,7 @@
 		strcpy(path + len, zso->suffix);
 		if (Py_VerboseFlag > 1)
 			PySys_WriteStderr("# trying %s%c%s\n",
-					  PyUnicode_AsString(self->archive),
+					  _PyUnicode_AsString(self->archive),
 					  SEP, path);
 		toc_entry = PyDict_GetItemString(self->files, path);
 		if (toc_entry != NULL) {
@@ -1119,7 +1119,7 @@
 				continue;
 			}
 			if (code != NULL && p_modpath != NULL)
-				*p_modpath = PyUnicode_AsString(
+				*p_modpath = _PyUnicode_AsString(
 					PyTuple_GetItem(toc_entry, 0));
 			return code;
 		}

Modified: python/branches/py3k/Objects/bytesobject.c
==============================================================================
--- python/branches/py3k/Objects/bytesobject.c	(original)
+++ python/branches/py3k/Objects/bytesobject.c	Thu Aug  7 20:54:33 2008
@@ -3230,7 +3230,7 @@
 	if (!result)
 		return NULL;
 
-	buf = PyUnicode_AsString(result);
+	buf = _PyUnicode_AsString(result);
 	if (!buf) {
 		Py_DECREF(result);
 		return NULL;

Modified: python/branches/py3k/Objects/codeobject.c
==============================================================================
--- python/branches/py3k/Objects/codeobject.c	(original)
+++ python/branches/py3k/Objects/codeobject.c	Thu Aug  7 20:54:33 2008
@@ -296,7 +296,7 @@
 	if (co->co_firstlineno != 0)
 		lineno = co->co_firstlineno;
 	if (co->co_filename && PyUnicode_Check(co->co_filename))
-		filename = PyUnicode_AsString(co->co_filename);
+		filename = _PyUnicode_AsString(co->co_filename);
 	return PyUnicode_FromFormat(
 	                "<code object %.100U at %p, file \"%.300s\", line %d>",
 	                co->co_name, co, filename, lineno);

Modified: python/branches/py3k/Objects/exceptions.c
==============================================================================
--- python/branches/py3k/Objects/exceptions.c	(original)
+++ python/branches/py3k/Objects/exceptions.c	Thu Aug  7 20:54:33 2008
@@ -943,7 +943,7 @@
        lineno here */
 
     if (self->filename && PyUnicode_Check(self->filename)) {
-	    filename = PyUnicode_AsString(self->filename);
+	    filename = _PyUnicode_AsString(self->filename);
     }
     have_lineno = (self->lineno != NULL) && PyLong_CheckExact(self->lineno);
 

Modified: python/branches/py3k/Objects/floatobject.c
==============================================================================
--- python/branches/py3k/Objects/floatobject.c	(original)
+++ python/branches/py3k/Objects/floatobject.c	Thu Aug  7 20:54:33 2008
@@ -1229,7 +1229,7 @@
 	 * exp+4*ndigits and exp-4*ndigits are within the range of a long.
 	 */
 
-	s = PyUnicode_AsStringAndSize(arg, &length);
+	s = _PyUnicode_AsStringAndSize(arg, &length);
 	if (s == NULL)
 		return NULL;
 	s_end = s + length;
@@ -1597,7 +1597,7 @@
 			     Py_TYPE(arg)->tp_name);
 		return NULL;
 	}
-	s = PyUnicode_AsString(arg);
+	s = _PyUnicode_AsString(arg);
 	if (s == NULL)
 		return NULL;
 	if (strcmp(s, "double") == 0) {

Modified: python/branches/py3k/Objects/funcobject.c
==============================================================================
--- python/branches/py3k/Objects/funcobject.c	(original)
+++ python/branches/py3k/Objects/funcobject.c	Thu Aug  7 20:54:33 2008
@@ -297,7 +297,7 @@
 		PyErr_Format(PyExc_ValueError,
 			     "%s() requires a code object with %zd free vars,"
 			     " not %zd",
-			     PyUnicode_AsString(op->func_name),
+			     _PyUnicode_AsString(op->func_name),
 			     nclosure, nfree);
 		return -1;
 	}

Modified: python/branches/py3k/Objects/moduleobject.c
==============================================================================
--- python/branches/py3k/Objects/moduleobject.c	(original)
+++ python/branches/py3k/Objects/moduleobject.c	Thu Aug  7 20:54:33 2008
@@ -187,7 +187,7 @@
 		PyErr_SetString(PyExc_SystemError, "nameless module");
 		return NULL;
 	}
-	return PyUnicode_AsString(nameobj);
+	return _PyUnicode_AsString(nameobj);
 }
 
 const char *
@@ -207,7 +207,7 @@
 		PyErr_SetString(PyExc_SystemError, "module filename missing");
 		return NULL;
 	}
-	return PyUnicode_AsString(fileobj);
+	return _PyUnicode_AsString(fileobj);
 }
 
 PyModuleDef*
@@ -252,7 +252,7 @@
 	pos = 0;
 	while (PyDict_Next(d, &pos, &key, &value)) {
 		if (value != Py_None && PyUnicode_Check(key)) {
-			const char *s = PyUnicode_AsString(key);
+			const char *s = _PyUnicode_AsString(key);
 			if (s[0] == '_' && s[1] != '_') {
 				if (Py_VerboseFlag > 1)
 				    PySys_WriteStderr("#   clear[1] %s\n", s);
@@ -265,7 +265,7 @@
 	pos = 0;
 	while (PyDict_Next(d, &pos, &key, &value)) {
 		if (value != Py_None && PyUnicode_Check(key)) {
-			const char *s = PyUnicode_AsString(key);
+			const char *s = _PyUnicode_AsString(key);
 			if (s[0] != '_' || strcmp(s, "__builtins__") != 0) {
 				if (Py_VerboseFlag > 1)
 				    PySys_WriteStderr("#   clear[2] %s\n", s);

Modified: python/branches/py3k/Objects/object.c
==============================================================================
--- python/branches/py3k/Objects/object.c	(original)
+++ python/branches/py3k/Objects/object.c	Thu Aug  7 20:54:33 2008
@@ -856,7 +856,7 @@
 	if (tp->tp_getattro != NULL)
 		return (*tp->tp_getattro)(v, name);
 	if (tp->tp_getattr != NULL)
-		return (*tp->tp_getattr)(v, PyUnicode_AsString(name));
+		return (*tp->tp_getattr)(v, _PyUnicode_AsString(name));
 	PyErr_Format(PyExc_AttributeError,
 		     "'%.50s' object has no attribute '%U'",
 		     tp->tp_name, name);
@@ -896,7 +896,7 @@
 		return err;
 	}
 	if (tp->tp_setattr != NULL) {
-		err = (*tp->tp_setattr)(v, PyUnicode_AsString(name), value);
+		err = (*tp->tp_setattr)(v, _PyUnicode_AsString(name), value);
 		Py_DECREF(name);
 		return err;
 	}
@@ -1062,7 +1062,7 @@
 
 	PyErr_Format(PyExc_AttributeError,
 		     "'%.50s' object has no attribute '%.400s'",
-		     tp->tp_name, PyUnicode_AsString(name));
+		     tp->tp_name, _PyUnicode_AsString(name));
   done:
 	Py_DECREF(name);
 	return res;

Modified: python/branches/py3k/Objects/setobject.c
==============================================================================
--- python/branches/py3k/Objects/setobject.c	(original)
+++ python/branches/py3k/Objects/setobject.c	Thu Aug  7 20:54:33 2008
@@ -2390,7 +2390,7 @@
 	/* Exercise direct iteration */
 	i = 0, count = 0;
 	while (_PySet_NextEntry((PyObject *)dup, &i, &x, &hash)) {
-		s = PyUnicode_AsString(x);
+		s = _PyUnicode_AsString(x);
 		assert(s && (s[0] == 'a' || s[0] == 'b' || s[0] == 'c'));
 		count++;
 	}

Modified: python/branches/py3k/Objects/structseq.c
==============================================================================
--- python/branches/py3k/Objects/structseq.c	(original)
+++ python/branches/py3k/Objects/structseq.c	Thu Aug  7 20:54:33 2008
@@ -270,7 +270,7 @@
 			Py_DECREF(tup);
 			return NULL;
 		}
-		crepr = PyUnicode_AsString(repr);
+		crepr = _PyUnicode_AsString(repr);
 		if (crepr == NULL) {
 			Py_DECREF(tup);
 			Py_DECREF(repr);

Modified: python/branches/py3k/Objects/typeobject.c
==============================================================================
--- python/branches/py3k/Objects/typeobject.c	(original)
+++ python/branches/py3k/Objects/typeobject.c	Thu Aug  7 20:54:33 2008
@@ -258,7 +258,7 @@
 	}
 	Py_DECREF(tmp);
 
-	tp_name = PyUnicode_AsString(value);
+	tp_name = _PyUnicode_AsString(value);
 	if (tp_name == NULL)
 		return -1;
 
@@ -1255,7 +1255,7 @@
 				o = class_name(o);
 				PyErr_Format(PyExc_TypeError,
 					     "duplicate base class %.400s",
-					     o ? PyUnicode_AsString(o) : "?");
+					     o ? _PyUnicode_AsString(o) : "?");
 				Py_XDECREF(o);
 				return -1;
 			}
@@ -1301,7 +1301,7 @@
 	while (PyDict_Next(set, &i, &k, &v) && (size_t)off < sizeof(buf)) {
 		PyObject *name = class_name(k);
 		off += PyOS_snprintf(buf + off, sizeof(buf) - off, " %s",
-				     name ? PyUnicode_AsString(name) : "?");
+				     name ? _PyUnicode_AsString(name) : "?");
 		Py_XDECREF(name);
 		if (--n && (size_t)(off+1) < sizeof(buf)) {
 			buf[off++] = ',';
@@ -2094,7 +2094,7 @@
 	type->tp_as_sequence = &et->as_sequence;
 	type->tp_as_mapping = &et->as_mapping;
 	type->tp_as_buffer = &et->as_buffer;
-	type->tp_name = PyUnicode_AsString(name);
+	type->tp_name = _PyUnicode_AsString(name);
 	if (!type->tp_name) {
 		Py_DECREF(type);
 		return NULL;
@@ -2136,7 +2136,7 @@
 			char *doc_str;
 			char *tp_doc;
 
-			doc_str = PyUnicode_AsStringAndSize(doc, &len);
+			doc_str = _PyUnicode_AsStringAndSize(doc, &len);
 			if (doc_str == NULL) {
 				Py_DECREF(type);
 				return NULL;
@@ -2175,7 +2175,7 @@
 	slotoffset = base->tp_basicsize;
 	if (slots != NULL) {
 		for (i = 0; i < nslots; i++, mp++) {
-			mp->name = PyUnicode_AsString(
+			mp->name = _PyUnicode_AsString(
 				PyTuple_GET_ITEM(slots, i));
 			mp->type = T_OBJECT_EX;
 			mp->offset = slotoffset;

Modified: python/branches/py3k/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k/Objects/unicodeobject.c	(original)
+++ python/branches/py3k/Objects/unicodeobject.c	Thu Aug  7 20:54:33 2008
@@ -1452,7 +1452,7 @@
 }
 
 char*
-PyUnicode_AsStringAndSize(PyObject *unicode, Py_ssize_t *psize)
+_PyUnicode_AsStringAndSize(PyObject *unicode, Py_ssize_t *psize)
 {
     PyObject *bytes;
     if (!PyUnicode_Check(unicode)) {
@@ -1468,9 +1468,9 @@
 }
 
 char*
-PyUnicode_AsString(PyObject *unicode)
+_PyUnicode_AsString(PyObject *unicode)
 {
-    return PyUnicode_AsStringAndSize(unicode, NULL);
+    return _PyUnicode_AsStringAndSize(unicode, NULL);
 }
 
 Py_UNICODE *PyUnicode_AsUnicode(PyObject *unicode)

Modified: python/branches/py3k/Objects/weakrefobject.c
==============================================================================
--- python/branches/py3k/Objects/weakrefobject.c	(original)
+++ python/branches/py3k/Objects/weakrefobject.c	Thu Aug  7 20:54:33 2008
@@ -167,7 +167,7 @@
 	if (nameobj == NULL)
 		PyErr_Clear();
 	else if (PyUnicode_Check(nameobj))
-		name = PyUnicode_AsString(nameobj);
+		name = _PyUnicode_AsString(nameobj);
         PyOS_snprintf(buffer, sizeof(buffer),
 		      name ? "<weakref at %p; to '%.50s' at %p (%s)>"
 		           : "<weakref at %p; to '%.50s' at %p>",

Modified: python/branches/py3k/Parser/tokenizer.c
==============================================================================
--- python/branches/py3k/Parser/tokenizer.c	(original)
+++ python/branches/py3k/Parser/tokenizer.c	Thu Aug  7 20:54:33 2008
@@ -391,7 +391,7 @@
 	}
 	if (PyUnicode_CheckExact(bufobj))
 	{
-		buf = PyUnicode_AsStringAndSize(bufobj, &buflen);
+		buf = _PyUnicode_AsStringAndSize(bufobj, &buflen);
 		if (buf == NULL) {
 			goto error;
 		}

Modified: python/branches/py3k/Python/_warnings.c
==============================================================================
--- python/branches/py3k/Python/_warnings.c	(original)
+++ python/branches/py3k/Python/_warnings.c	Thu Aug  7 20:54:33 2008
@@ -132,7 +132,7 @@
             return NULL;
 
         if (good_msg && is_subclass && good_mod && (ln == 0 || lineno == ln))
-            return PyUnicode_AsString(action);
+            return _PyUnicode_AsString(action);
     }
 
     m = PyImport_ImportModule(MODULE_NAME);
@@ -144,7 +144,7 @@
         return NULL;
     action = PyDict_GetItemString(d, DEFAULT_ACTION_NAME);
     if (action != NULL)
-        return PyUnicode_AsString(action);
+        return _PyUnicode_AsString(action);
 
     PyErr_SetString(PyExc_ValueError,
                     MODULE_NAME "." DEFAULT_ACTION_NAME " not found");
@@ -186,7 +186,7 @@
     else if (rc == 0)
         return PyUnicode_FromString("<unknown>");
 
-    mod_str = PyUnicode_AsString(filename);
+    mod_str = _PyUnicode_AsString(filename);
     if (mod_str == NULL)
 	    return NULL;
     len = PyUnicode_GetSize(filename);
@@ -257,7 +257,7 @@
 
     /* Print "  source_line\n" */
     if (sourceline) {
-        char *source_line_str = PyUnicode_AsString(sourceline);
+        char *source_line_str = _PyUnicode_AsString(sourceline);
         while (*source_line_str == ' ' || *source_line_str == '\t' ||
                 *source_line_str == '\014')
             source_line_str++;
@@ -266,7 +266,7 @@
         PyFile_WriteString("\n", f_stderr);
     }
     else
-        _Py_DisplaySourceLine(f_stderr, PyUnicode_AsString(filename),
+        _Py_DisplaySourceLine(f_stderr, _PyUnicode_AsString(filename),
                               lineno, 2);
     PyErr_Clear();
 }
@@ -367,7 +367,7 @@
             const char *err_str = "???";
 
             if (to_str != NULL)
-                err_str = PyUnicode_AsString(to_str);
+                err_str = _PyUnicode_AsString(to_str);
             PyErr_Format(PyExc_RuntimeError,
                         "Unrecognized action (%s) in warnings.filters:\n %s",
                         action, err_str);
@@ -388,7 +388,7 @@
         else {
             const char *msg = "functions overriding warnings.showwarning() "
                                 "must support the 'line' argument";
-            const char *text_char = PyUnicode_AsString(text);
+            const char *text_char = _PyUnicode_AsString(text);
 
             if (strcmp(msg, text_char) == 0) {
                 /* Prevent infinite recursion by using built-in implementation
@@ -503,7 +503,7 @@
     *filename = PyDict_GetItemString(globals, "__file__");
     if (*filename != NULL) {
         Py_ssize_t len = PyUnicode_GetSize(*filename);
-        const char *file_str = PyUnicode_AsString(*filename);
+        const char *file_str = _PyUnicode_AsString(*filename);
 	    if (file_str == NULL || (len < 0 && PyErr_Occurred()))
             goto handle_error;
 
@@ -523,7 +523,7 @@
             Py_INCREF(*filename);
     }
     else {
-        const char *module_str = PyUnicode_AsString(*module);
+        const char *module_str = _PyUnicode_AsString(*module);
         if (module_str && strcmp(module_str, "__main__") == 0) {
             PyObject *argv = PySys_GetObject("argv");
             if (argv != NULL && PyList_Size(argv) > 0) {

Modified: python/branches/py3k/Python/ast.c
==============================================================================
--- python/branches/py3k/Python/ast.c	(original)
+++ python/branches/py3k/Python/ast.c	Thu Aug  7 20:54:33 2008
@@ -1324,7 +1324,7 @@
                 if (errstr) {
                     char *s = "";
                     char buf[128];
-                    s = PyUnicode_AsString(errstr);
+                    s = _PyUnicode_AsString(errstr);
                     PyOS_snprintf(buf, sizeof(buf), "(unicode error) %s", s);
                     ast_error(n, buf);
                 } else {

Modified: python/branches/py3k/Python/bltinmodule.c
==============================================================================
--- python/branches/py3k/Python/bltinmodule.c	(original)
+++ python/branches/py3k/Python/bltinmodule.c	Thu Aug  7 20:54:33 2008
@@ -1606,7 +1606,7 @@
 				Py_DECREF(stdin_encoding);
 				return NULL;
 			}
-			prompt = PyUnicode_AsString(po);
+			prompt = _PyUnicode_AsString(po);
 			if (prompt == NULL) {
 				Py_DECREF(stdin_encoding);
 				Py_DECREF(po);
@@ -1639,7 +1639,7 @@
 			else {
 				result = PyUnicode_Decode
 					(s, len-1,
-					 PyUnicode_AsString(stdin_encoding),
+					 _PyUnicode_AsString(stdin_encoding),
 					 NULL);
 			}
 		}

Modified: python/branches/py3k/Python/ceval.c
==============================================================================
--- python/branches/py3k/Python/ceval.c	(original)
+++ python/branches/py3k/Python/ceval.c	Thu Aug  7 20:54:33 2008
@@ -859,7 +859,7 @@
 	lltrace = PyDict_GetItemString(f->f_globals, "__lltrace__") != NULL;
 #endif
 #if defined(Py_DEBUG) || defined(LLTRACE)
-	filename = PyUnicode_AsString(co->co_filename);
+	filename = _PyUnicode_AsString(co->co_filename);
 #endif
 
 	why = WHY_NOT;
@@ -3291,7 +3291,7 @@
 	if (PyMethod_Check(func))
 		return PyEval_GetFuncName(PyMethod_GET_FUNCTION(func));
 	else if (PyFunction_Check(func))
-		return PyUnicode_AsString(((PyFunctionObject*)func)->func_name);
+		return _PyUnicode_AsString(((PyFunctionObject*)func)->func_name);
 	else if (PyCFunction_Check(func))
 		return ((PyCFunctionObject*)func)->m_ml->ml_name;
 	else
@@ -3527,7 +3527,7 @@
 				     "for keyword argument '%.200s'",
 				     PyEval_GetFuncName(func),
 				     PyEval_GetFuncDesc(func),
-				     PyUnicode_AsString(key));
+				     _PyUnicode_AsString(key));
 			Py_DECREF(key);
 			Py_DECREF(value);
 			Py_DECREF(kwdict);
@@ -3874,7 +3874,7 @@
 	if (!obj)
 		return;
 
-	obj_str = PyUnicode_AsString(obj);
+	obj_str = _PyUnicode_AsString(obj);
 	if (!obj_str)
 		return;
 

Modified: python/branches/py3k/Python/compile.c
==============================================================================
--- python/branches/py3k/Python/compile.c	(original)
+++ python/branches/py3k/Python/compile.c	Thu Aug  7 20:54:33 2008
@@ -1300,7 +1300,7 @@
 				PyObject_REPR(name), 
 				PyBytes_AS_STRING(c->u->u_name), 
 				reftype, arg,
-				PyUnicode_AsString(co->co_name),
+				_PyUnicode_AsString(co->co_name),
 				PyObject_REPR(co->co_freevars));
 			Py_FatalError("compiler_make_closure()");
 		}

Modified: python/branches/py3k/Python/errors.c
==============================================================================
--- python/branches/py3k/Python/errors.c	(original)
+++ python/branches/py3k/Python/errors.c	Thu Aug  7 20:54:33 2008
@@ -709,7 +709,7 @@
 			if (moduleName == NULL)
 				PyFile_WriteString("<unknown>", f);
 			else {
-				char* modstr = PyUnicode_AsString(moduleName);
+				char* modstr = _PyUnicode_AsString(moduleName);
 				if (modstr &&
 				    strcmp(modstr, "builtins") != 0)
 				{

Modified: python/branches/py3k/Python/future.c
==============================================================================
--- python/branches/py3k/Python/future.c	(original)
+++ python/branches/py3k/Python/future.c	Thu Aug  7 20:54:33 2008
@@ -20,7 +20,7 @@
 	names = s->v.ImportFrom.names;
 	for (i = 0; i < asdl_seq_LEN(names); i++) {
                 alias_ty name = (alias_ty)asdl_seq_GET(names, i);
-		const char *feature = PyUnicode_AsString(name->name);
+		const char *feature = _PyUnicode_AsString(name->name);
 		if (!feature)
 			return 0;
 		if (strcmp(feature, FUTURE_NESTED_SCOPES) == 0) {

Modified: python/branches/py3k/Python/getargs.c
==============================================================================
--- python/branches/py3k/Python/getargs.c	(original)
+++ python/branches/py3k/Python/getargs.c	Thu Aug  7 20:54:33 2008
@@ -1537,7 +1537,7 @@
 					        "keywords must be strings");
 				return cleanreturn(0, freelist);
 			}
-			ks = PyUnicode_AsString(key);
+			ks = _PyUnicode_AsString(key);
 			for (i = 0; i < len; i++) {
 				if (!strcmp(ks, kwlist[i])) {
 					match = 1;

Modified: python/branches/py3k/Python/import.c
==============================================================================
--- python/branches/py3k/Python/import.c	(original)
+++ python/branches/py3k/Python/import.c	Thu Aug  7 20:54:33 2008
@@ -470,7 +470,7 @@
 			if (value->ob_refcnt != 1)
 				continue;
 			if (PyUnicode_Check(key) && PyModule_Check(value)) {
-				name = PyUnicode_AsString(key);
+				name = _PyUnicode_AsString(key);
 				if (strcmp(name, "builtins") == 0)
 					continue;
 				if (strcmp(name, "sys") == 0)
@@ -489,7 +489,7 @@
 	pos = 0;
 	while (PyDict_Next(modules, &pos, &key, &value)) {
 		if (PyUnicode_Check(key) && PyModule_Check(value)) {
-			name = PyUnicode_AsString(key);
+			name = _PyUnicode_AsString(key);
 			if (strcmp(name, "builtins") == 0)
 				continue;
 			if (strcmp(name, "sys") == 0)
@@ -1296,7 +1296,7 @@
 	if (path != NULL && PyUnicode_Check(path)) {
 		/* The only type of submodule allowed inside a "frozen"
 		   package are other frozen modules or packages. */
-		char *p = PyUnicode_AsString(path);
+		char *p = _PyUnicode_AsString(path);
 		if (strlen(p) + 1 + strlen(name) >= (size_t)buflen) {
 			PyErr_SetString(PyExc_ImportError,
 					"full frozen module name too long");
@@ -2197,7 +2197,7 @@
 					"__package__ set to non-string");
 			return NULL;
 		}
-		pkgname_str = PyUnicode_AsStringAndSize(pkgname, &len);
+		pkgname_str = _PyUnicode_AsStringAndSize(pkgname, &len);
 		if (len == 0) {
 			if (level > 0) {
 				PyErr_SetString(PyExc_ValueError,
@@ -2225,7 +2225,7 @@
 			Py_ssize_t len;
 			int error;
 
-			modname_str = PyUnicode_AsStringAndSize(modname, &len);
+			modname_str = _PyUnicode_AsStringAndSize(modname, &len);
 			if (len > MAXPATHLEN) {
 				PyErr_SetString(PyExc_ValueError,
 						"Module name too long");
@@ -2240,7 +2240,7 @@
 			}
 		} else {
 			/* Normal module, so work out the package name if any */
-			char *start = PyUnicode_AsString(modname);
+			char *start = _PyUnicode_AsString(modname);
 			char *lastdot = strrchr(start, '.');
 			size_t len;
 			int error;
@@ -2635,7 +2635,7 @@
 		if (parent == NULL) {
 			PyErr_Format(PyExc_ImportError,
 			    "reload(): parent %.200s not in sys.modules",
-			     PyUnicode_AsString(parentname));
+			     _PyUnicode_AsString(parentname));
 			Py_DECREF(parentname);
 			imp_modules_reloading_clear();
 			return NULL;

Modified: python/branches/py3k/Python/peephole.c
==============================================================================
--- python/branches/py3k/Python/peephole.c	(original)
+++ python/branches/py3k/Python/peephole.c	Thu Aug  7 20:54:33 2008
@@ -407,7 +407,7 @@
 			case LOAD_NAME:
 			case LOAD_GLOBAL:
 				j = GETARG(codestr, i);
-				name = PyUnicode_AsString(PyTuple_GET_ITEM(names, j));
+				name = _PyUnicode_AsString(PyTuple_GET_ITEM(names, j));
 				h = load_global(codestr, i, name, consts);
 				if (h < 0)
 					goto exitUnchanged;

Modified: python/branches/py3k/Python/pythonrun.c
==============================================================================
--- python/branches/py3k/Python/pythonrun.c	(original)
+++ python/branches/py3k/Python/pythonrun.c	Thu Aug  7 20:54:33 2008
@@ -803,7 +803,7 @@
 	encoding_attr = PyObject_GetAttrString(std, "encoding");
 	if (encoding_attr != NULL) {
 		const char * encoding;
-		encoding = PyUnicode_AsString(encoding_attr);
+		encoding = _PyUnicode_AsString(encoding_attr);
 		if (encoding != NULL) {
 			_PyCodec_Lookup(encoding);
 		}
@@ -909,7 +909,7 @@
 		oenc = PyObject_GetAttrString(v, "encoding");
 		if (!oenc)
 			return -1;
-		enc = PyUnicode_AsString(oenc);
+		enc = _PyUnicode_AsString(oenc);
 	}
 	v = PySys_GetObject("ps1");
 	if (v != NULL) {
@@ -917,7 +917,7 @@
 		if (v == NULL)
 			PyErr_Clear();
 		else if (PyUnicode_Check(v))
-			ps1 = PyUnicode_AsString(v);
+			ps1 = _PyUnicode_AsString(v);
 	}
 	w = PySys_GetObject("ps2");
 	if (w != NULL) {
@@ -925,7 +925,7 @@
 		if (w == NULL)
 			PyErr_Clear();
 		else if (PyUnicode_Check(w))
-			ps2 = PyUnicode_AsString(w);
+			ps2 = _PyUnicode_AsString(w);
 	}
 	arena = PyArena_New();
 	if (arena == NULL) {
@@ -1101,7 +1101,7 @@
 		goto finally;
 	if (v == Py_None)
 		*filename = NULL;
-	else if (! (*filename = PyUnicode_AsString(v)))
+	else if (! (*filename = _PyUnicode_AsString(v)))
 		goto finally;
 
 	Py_DECREF(v);
@@ -1134,7 +1134,7 @@
 	if (v == Py_None)
 		*text = NULL;
         else if (!PyUnicode_Check(v) ||
-		 !(*text = PyUnicode_AsString(v)))
+		 !(*text = _PyUnicode_AsString(v)))
 		goto finally;
 	Py_DECREF(v);
 	return 1;
@@ -1357,7 +1357,7 @@
 			err = PyFile_WriteString("<unknown>", f);
 		}
 		else {
-			char* modstr = PyUnicode_AsString(moduleName);
+			char* modstr = _PyUnicode_AsString(moduleName);
 			if (modstr && strcmp(modstr, "builtins"))
 			{
 				err = PyFile_WriteString(modstr, f);
@@ -1806,7 +1806,7 @@
 		if (value != NULL) {
 			u = PyObject_Str(value);
 			if (u != NULL) {
-				msg = PyUnicode_AsString(u);
+				msg = _PyUnicode_AsString(u);
 			}
 		}
 		if (msg == NULL)

Modified: python/branches/py3k/Python/structmember.c
==============================================================================
--- python/branches/py3k/Python/structmember.c	(original)
+++ python/branches/py3k/Python/structmember.c	Thu Aug  7 20:54:33 2008
@@ -247,7 +247,7 @@
 			PyErr_BadArgument();
 			return -1;
 		}
-		string = PyUnicode_AsStringAndSize(v, &len);
+		string = _PyUnicode_AsStringAndSize(v, &len);
 		if (len != 1) {
 			PyErr_BadArgument();
 			return -1;

Modified: python/branches/py3k/Python/symtable.c
==============================================================================
--- python/branches/py3k/Python/symtable.c	(original)
+++ python/branches/py3k/Python/symtable.c	Thu Aug  7 20:54:33 2008
@@ -1142,7 +1142,7 @@
 		asdl_seq *seq = s->v.Global.names;
 		for (i = 0; i < asdl_seq_LEN(seq); i++) {
 			identifier name = (identifier)asdl_seq_GET(seq, i);
-			char *c_name = PyUnicode_AsString(name);
+			char *c_name = _PyUnicode_AsString(name);
 			long cur = symtable_lookup(st, name);
 			if (cur < 0)
 				return 0;
@@ -1169,7 +1169,7 @@
 		asdl_seq *seq = s->v.Nonlocal.names;
 		for (i = 0; i < asdl_seq_LEN(seq); i++) {
 			identifier name = (identifier)asdl_seq_GET(seq, i);
-			char *c_name = PyUnicode_AsString(name);
+			char *c_name = _PyUnicode_AsString(name);
 			long cur = symtable_lookup(st, name);
 			if (cur < 0)
 				return 0;

Modified: python/branches/py3k/Python/traceback.c
==============================================================================
--- python/branches/py3k/Python/traceback.c	(original)
+++ python/branches/py3k/Python/traceback.c	Thu Aug  7 20:54:33 2008
@@ -257,10 +257,10 @@
 	while (tb != NULL && err == 0) {
 		if (depth <= limit) {
 			err = tb_displayline(f,
-			    PyUnicode_AsString(
+			    _PyUnicode_AsString(
 				    tb->tb_frame->f_code->co_filename),
 			    tb->tb_lineno,
-			    PyUnicode_AsString(tb->tb_frame->f_code->co_name));
+			    _PyUnicode_AsString(tb->tb_frame->f_code->co_name));
 		}
 		depth--;
 		tb = tb->tb_next;


More information about the Python-3000-checkins mailing list