]> granicus.if.org Git - python/commitdiff
Get rid of more uses of string and use unicode
authorNeal Norwitz <nnorwitz@gmail.com>
Sat, 27 Oct 2007 04:00:45 +0000 (04:00 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sat, 27 Oct 2007 04:00:45 +0000 (04:00 +0000)
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

index 2caf9855c64052cb88749f719b7c09ebe84aedad..eaa355fa491c27b1f93a667ab79512689d83965f 100644 (file)
@@ -23,14 +23,14 @@ Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 
     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 @@ Noddy_name(Noddy* self)
     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 @@ Noddy_name(Noddy* self)
     if (args == NULL)
         return NULL;
 
-    result = PyString_Format(format, args);
+    result = PyUnicode_Format(format, args);
     Py_DECREF(args);
     
     return result;
index 60260ada52fa8e0dd68619f383011fe739a6338c..3a1c0c2beb12577c679fcf48809dcf0c08c6268f 100644 (file)
@@ -23,14 +23,14 @@ Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 
     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 @@ Noddy_setfirst(Noddy *self, PyObject *value, void *closure)
     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 @@ Noddy_setlast(Noddy *self, PyObject *value, void *closure)
     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 @@ Noddy_name(Noddy* self)
     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 @@ Noddy_name(Noddy* self)
     if (args == NULL)
         return NULL;
 
-    result = PyString_Format(format, args);
+    result = PyUnicode_Format(format, args);
     Py_DECREF(args);
     
     return result;
index 878e0861d873fa96877aab40bd6a2783cd9a4e68..ac0b1f4d4074b1311c3a222edb3b8c8ae5b6e259 100644 (file)
@@ -57,14 +57,14 @@ Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 
     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 @@ Noddy_name(Noddy* self)
     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 @@ Noddy_name(Noddy* self)
     if (args == NULL)
         return NULL;
 
-    result = PyString_Format(format, args);
+    result = PyUnicode_Format(format, args);
     Py_DECREF(args);
     
     return result;
index 5a7df0d98056bc371aaaf4e4fdadf616527803e9..e4f5a27624116d63dbcd5148322d5366bd804bdb 100644 (file)
@@ -13,7 +13,7 @@ main(int argc, char *argv[])
     }
 
     Py_Initialize();
-    pName = PyString_FromString(argv[1]);
+    pName = PyUnicode_FromString(argv[1]);
     /* Error checking of pName left out */
 
     pModule = PyImport_Import(pName);
index a5740e79d7e3228f7f7996f30c9f21709aa001a9..7e85dcf8d4bd79de3ed5a8bb0735bce43aef9159 100644 (file)
@@ -179,10 +179,7 @@ normalizeUserObj(PyObject *obj)
                /* 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)) {
index 041cf9d10494770c68648dc9bbf0b3b252cbc45b..abe4bde084c8798607f78f8c29c2426a8af90ee0 100644 (file)
@@ -1882,7 +1882,7 @@ _PyExc_Init(void)
            (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");
index 7ec7ed5443be3f3cca6b3f0044437b995d21faf4..cf41ddda00b28df52caab1520b44470c7b6366b4 100644 (file)
@@ -721,7 +721,7 @@ map_to_dict(PyObject *map, Py_ssize_t nmap, PyObject *dict, PyObject **values,
        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);