@@ -40,7 +40,7 @@ builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
4040 }
4141 func = PyTuple_GET_ITEM (args , 0 ); /* Better be callable */
4242 name = PyTuple_GET_ITEM (args , 1 );
43- if ((! PyString_Check ( name ) && ! PyUnicode_Check (name ) )) {
43+ if (! PyUnicode_Check (name )) {
4444 PyErr_SetString (PyExc_TypeError ,
4545 "__build_class__: name is not a string" );
4646 return NULL ;
@@ -631,8 +631,7 @@ builtin_exec(PyObject *self, PyObject *args)
631631 }
632632 else if (locals == Py_None )
633633 locals = globals ;
634- if (!PyString_Check (prog ) &&
635- !PyUnicode_Check (prog ) &&
634+ if (!PyUnicode_Check (prog ) &&
636635 !PyCode_Check (prog )) {
637636 PyErr_Format (PyExc_TypeError ,
638637 "exec() arg 1 must be a string, file, or code "
@@ -695,23 +694,15 @@ globals and locals. If only globals is given, locals defaults to it.");
695694static PyObject *
696695builtin_getattr (PyObject * self , PyObject * args )
697696{
698- PyObject * v , * result , * dflt = NULL , * release = NULL ;
697+ PyObject * v , * result , * dflt = NULL ;
699698 PyObject * name ;
700699
701700 if (!PyArg_UnpackTuple (args , "getattr" , 2 , 3 , & v , & name , & dflt ))
702701 return NULL ;
703702
704- if (PyString_Check (name )) {
705- release = PyString_AsDecodedObject (name , NULL , NULL );
706- if (!release )
707- return NULL ;
708- name = release ;
709- }
710-
711703 if (!PyUnicode_Check (name )) {
712704 PyErr_SetString (PyExc_TypeError ,
713705 "getattr(): attribute name must be string" );
714- Py_XDECREF (release );
715706 return NULL ;
716707 }
717708 result = PyObject_GetAttr (v , name );
@@ -722,7 +713,6 @@ builtin_getattr(PyObject *self, PyObject *args)
722713 Py_INCREF (dflt );
723714 result = dflt ;
724715 }
725- Py_XDECREF (release );
726716 return result ;
727717}
728718
@@ -1221,17 +1211,15 @@ builtin_print(PyObject *self, PyObject *args, PyObject *kwds)
12211211 if (file == NULL || file == Py_None )
12221212 file = PySys_GetObject ("stdout" );
12231213
1224- if (sep && sep != Py_None && !PyString_Check (sep ) &&
1225- !PyUnicode_Check (sep )) {
1214+ if (sep && sep != Py_None && !PyUnicode_Check (sep )) {
12261215 PyErr_Format (PyExc_TypeError ,
1227- "sep must be None, str or unicode , not %.200s" ,
1216+ "sep must be None or a string , not %.200s" ,
12281217 sep -> ob_type -> tp_name );
12291218 return NULL ;
12301219 }
1231- if (end && end != Py_None && !PyString_Check (end ) &&
1232- !PyUnicode_Check (end )) {
1220+ if (end && end != Py_None && !PyUnicode_Check (end )) {
12331221 PyErr_Format (PyExc_TypeError ,
1234- "end must be None, str or unicode , not %.200s" ,
1222+ "end must be None or a string , not %.200s" ,
12351223 end -> ob_type -> tp_name );
12361224 return NULL ;
12371225 }
@@ -1383,7 +1371,7 @@ builtin_input(PyObject *self, PyObject *args)
13831371 result = NULL ;
13841372 }
13851373 else {
1386- result = PyString_FromStringAndSize (s , len - 1 );
1374+ result = PyUnicode_FromStringAndSize (s , len - 1 );
13871375 }
13881376 }
13891377 PyMem_FREE (s );
0 commit comments