[Python-3000-checkins] r58684 - in python/branches/py3k: Doc/includes/noddy2.c Doc/includes/noddy3.c Doc/includes/noddy4.c Doc/includes/run-func.c Modules/_lsprof.c Objects/exceptions.c Objects/frameobject.c

neal.norwitz python-3000-checkins at python.org
Sat Oct 27 06:00:46 CEST 2007


Author: neal.norwitz
Date: Sat Oct 27 06:00:45 2007
New Revision: 58684

Modified:
   python/branches/py3k/Doc/includes/noddy2.c
   python/branches/py3k/Doc/includes/noddy3.c
   python/branches/py3k/Doc/includes/noddy4.c
   python/branches/py3k/Doc/includes/run-func.c
   python/branches/py3k/Modules/_lsprof.c
   python/branches/py3k/Objects/exceptions.c
   python/branches/py3k/Objects/frameobject.c
Log:
Get rid of more uses of string and use unicode

Modified: python/branches/py3k/Doc/includes/noddy2.c
==============================================================================
--- python/branches/py3k/Doc/includes/noddy2.c	(original)
+++ python/branches/py3k/Doc/includes/noddy2.c	Sat Oct 27 06:00:45 2007
@@ -23,14 +23,14 @@
 
     self = (Noddy *)type->tp_alloc(type, 0);
     if (self != NULL) {
-        self->first = PyString_FromString("");
+        self->first = PyUnicode_FromString("");
         if (self->first == NULL)
           {
             Py_DECREF(self);
             return NULL;
           }
         
-        self->last = PyString_FromString("");
+        self->last = PyUnicode_FromString("");
         if (self->last == NULL)
           {
             Py_DECREF(self);
@@ -90,7 +90,7 @@
     PyObject *args, *result;
 
     if (format == NULL) {
-        format = PyString_FromString("%s %s");
+        format = PyUnicode_FromString("%s %s");
         if (format == NULL)
             return NULL;
     }
@@ -109,7 +109,7 @@
     if (args == NULL)
         return NULL;
 
-    result = PyString_Format(format, args);
+    result = PyUnicode_Format(format, args);
     Py_DECREF(args);
     
     return result;

Modified: python/branches/py3k/Doc/includes/noddy3.c
==============================================================================
--- python/branches/py3k/Doc/includes/noddy3.c	(original)
+++ python/branches/py3k/Doc/includes/noddy3.c	Sat Oct 27 06:00:45 2007
@@ -23,14 +23,14 @@
 
     self = (Noddy *)type->tp_alloc(type, 0);
     if (self != NULL) {
-        self->first = PyString_FromString("");
+        self->first = PyUnicode_FromString("");
         if (self->first == NULL)
           {
             Py_DECREF(self);
             return NULL;
           }
         
-        self->last = PyString_FromString("");
+        self->last = PyUnicode_FromString("");
         if (self->last == NULL)
           {
             Py_DECREF(self);
@@ -93,7 +93,7 @@
     return -1;
   }
   
-  if (! PyString_Check(value)) {
+  if (! PyUnicode_Check(value)) {
     PyErr_SetString(PyExc_TypeError, 
                     "The first attribute value must be a string");
     return -1;
@@ -121,7 +121,7 @@
     return -1;
   }
   
-  if (! PyString_Check(value)) {
+  if (! PyUnicode_Check(value)) {
     PyErr_SetString(PyExc_TypeError, 
                     "The last attribute value must be a string");
     return -1;
@@ -153,7 +153,7 @@
     PyObject *args, *result;
 
     if (format == NULL) {
-        format = PyString_FromString("%s %s");
+        format = PyUnicode_FromString("%s %s");
         if (format == NULL)
             return NULL;
     }
@@ -162,7 +162,7 @@
     if (args == NULL)
         return NULL;
 
-    result = PyString_Format(format, args);
+    result = PyUnicode_Format(format, args);
     Py_DECREF(args);
     
     return result;

Modified: python/branches/py3k/Doc/includes/noddy4.c
==============================================================================
--- python/branches/py3k/Doc/includes/noddy4.c	(original)
+++ python/branches/py3k/Doc/includes/noddy4.c	Sat Oct 27 06:00:45 2007
@@ -57,14 +57,14 @@
 
     self = (Noddy *)type->tp_alloc(type, 0);
     if (self != NULL) {
-        self->first = PyString_FromString("");
+        self->first = PyUnicode_FromString("");
         if (self->first == NULL)
           {
             Py_DECREF(self);
             return NULL;
           }
         
-        self->last = PyString_FromString("");
+        self->last = PyUnicode_FromString("");
         if (self->last == NULL)
           {
             Py_DECREF(self);
@@ -124,7 +124,7 @@
     PyObject *args, *result;
 
     if (format == NULL) {
-        format = PyString_FromString("%s %s");
+        format = PyUnicode_FromString("%s %s");
         if (format == NULL)
             return NULL;
     }
@@ -143,7 +143,7 @@
     if (args == NULL)
         return NULL;
 
-    result = PyString_Format(format, args);
+    result = PyUnicode_Format(format, args);
     Py_DECREF(args);
     
     return result;

Modified: python/branches/py3k/Doc/includes/run-func.c
==============================================================================
--- python/branches/py3k/Doc/includes/run-func.c	(original)
+++ python/branches/py3k/Doc/includes/run-func.c	Sat Oct 27 06:00:45 2007
@@ -13,7 +13,7 @@
     }
 
     Py_Initialize();
-    pName = PyString_FromString(argv[1]);
+    pName = PyUnicode_FromString(argv[1]);
     /* Error checking of pName left out */
 
     pModule = PyImport_Import(pName);

Modified: python/branches/py3k/Modules/_lsprof.c
==============================================================================
--- python/branches/py3k/Modules/_lsprof.c	(original)
+++ python/branches/py3k/Modules/_lsprof.c	Sat Oct 27 06:00:45 2007
@@ -179,10 +179,7 @@
 		/* built-in function: look up the module name */
 		PyObject *mod = fn->m_module;
 		const char *modname;
-		if (mod && PyString_Check(mod)) {
-			modname = PyString_AS_STRING(mod);
-		}
-		else if (mod && PyUnicode_Check(mod)) {
+		if (mod && PyUnicode_Check(mod)) {
 			modname = PyUnicode_AsString(mod);
 		}
 		else if (mod && PyModule_Check(mod)) {

Modified: python/branches/py3k/Objects/exceptions.c
==============================================================================
--- python/branches/py3k/Objects/exceptions.c	(original)
+++ python/branches/py3k/Objects/exceptions.c	Sat Oct 27 06:00:45 2007
@@ -1882,7 +1882,7 @@
 	    (PyBaseExceptionObject *)PyExc_RecursionErrorInst;
 	PyObject *args_tuple;
 	PyObject *exc_message;
-	exc_message = PyString_FromString("maximum recursion depth exceeded");
+	exc_message = PyUnicode_FromString("maximum recursion depth exceeded");
 	if (!exc_message)
 	    Py_FatalError("cannot allocate argument for RuntimeError "
 			    "pre-allocation");

Modified: python/branches/py3k/Objects/frameobject.c
==============================================================================
--- python/branches/py3k/Objects/frameobject.c	(original)
+++ python/branches/py3k/Objects/frameobject.c	Sat Oct 27 06:00:45 2007
@@ -721,7 +721,7 @@
 	for (j = nmap; --j >= 0; ) {
 		PyObject *key = PyTuple_GET_ITEM(map, j);
 		PyObject *value = values[j];
-		assert(PyString_Check(key)/*XXX this should go*/ || PyUnicode_Check(key));
+		assert(PyUnicode_Check(key));
 		if (deref) {
 			assert(PyCell_Check(value));
 			value = PyCell_GET(value);


More information about the Python-3000-checkins mailing list