@@ -54,7 +54,7 @@ PyModule_GetDict(PyObject *m)
5454 return d ;
5555}
5656
57- char *
57+ const char *
5858PyModule_GetName (PyObject * m )
5959{
6060 PyObject * d ;
@@ -79,7 +79,7 @@ PyModule_GetName(PyObject *m)
7979 return PyString_AsString (nameobj );
8080}
8181
82- char *
82+ const char *
8383PyModule_GetFilename (PyObject * m )
8484{
8585 PyObject * d ;
@@ -120,8 +120,8 @@ _PyModule_Clear(PyObject *m)
120120 /* First, clear only names starting with a single underscore */
121121 pos = 0 ;
122122 while (PyDict_Next (d , & pos , & key , & value )) {
123- if (value != Py_None && PyString_Check (key )) {
124- char * s = PyString_AsString (key );
123+ if (value != Py_None && PyUnicode_Check (key )) {
124+ const char * s = PyUnicode_AsString (key );
125125 if (s [0 ] == '_' && s [1 ] != '_' ) {
126126 if (Py_VerboseFlag > 1 )
127127 PySys_WriteStderr ("# clear[1] %s\n" , s );
@@ -133,8 +133,8 @@ _PyModule_Clear(PyObject *m)
133133 /* Next, clear all names except for __builtins__ */
134134 pos = 0 ;
135135 while (PyDict_Next (d , & pos , & key , & value )) {
136- if (value != Py_None && PyString_Check (key )) {
137- char * s = PyString_AsString (key );
136+ if (value != Py_None && PyUnicode_Check (key )) {
137+ const char * s = PyUnicode_AsString (key );
138138 if (s [0 ] != '_' || strcmp (s , "__builtins__" ) != 0 ) {
139139 if (Py_VerboseFlag > 1 )
140140 PySys_WriteStderr ("# clear[2] %s\n" , s );
@@ -187,8 +187,8 @@ module_dealloc(PyModuleObject *m)
187187static PyObject *
188188module_repr (PyModuleObject * m )
189189{
190- char * name ;
191- char * filename ;
190+ const char * name ;
191+ const char * filename ;
192192
193193 name = PyModule_GetName ((PyObject * )m );
194194 if (name == NULL ) {
0 commit comments