File tree Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Expand file tree Collapse file tree 1 file changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -101,20 +101,20 @@ normalizestring(const char *string)
101101 return NULL ;
102102 }
103103
104- encoding = PyMem_Malloc (len + 1 );
105- if (encoding == NULL ) {
104+ p = PyMem_Malloc (len + 1 );
105+ if (p == NULL )
106106 return PyErr_NoMemory ();
107- }
108-
109- if (! _Py_normalize_encoding ( string , encoding , len + 1 , 1 ) )
110- {
111- PyErr_SetString ( PyExc_RuntimeError , "_Py_normalize_encoding() failed" );
112- PyMem_Free ( encoding );
113- return NULL ;
114- }
115-
116- v = PyUnicode_FromString (encoding );
117- PyMem_Free (encoding );
107+ for ( i = 0 ; i < len ; i ++ ) {
108+ char ch = string [ i ];
109+ if ( ch == ' ' )
110+ ch = '-' ;
111+ else
112+ ch = Py_TOLOWER ( Py_CHARMASK ( ch ) );
113+ p [ i ] = ch ;
114+ }
115+ p [ i ] = '\0' ;
116+ v = PyUnicode_FromString (p );
117+ PyMem_Free (p );
118118 return v ;
119119}
120120
You can’t perform that action at this time.
0 commit comments