File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,27 +52,13 @@ Py_FrozenMain(int argc, char **argv)
5252 oldloc = setlocale (LC_ALL , NULL );
5353 setlocale (LC_ALL , "" );
5454 for (i = 0 ; i < argc ; i ++ ) {
55- #ifdef HAVE_BROKEN_MBSTOWCS
56- size_t argsize = strlen (argv [i ]);
57- #else
58- size_t argsize = mbstowcs (NULL , argv [i ], 0 );
59- #endif
60- size_t count ;
61- if (argsize == (size_t )-1 ) {
62- fprintf (stderr , "Could not convert argument %d to string\n" , i );
63- return 1 ;
64- }
65- argv_copy [i ] = PyMem_RawMalloc ((argsize + 1 )* sizeof (wchar_t ));
66- argv_copy2 [i ] = argv_copy [i ];
55+ argv_copy [i ] = _Py_char2wchar (argv [i ], NULL );
6756 if (!argv_copy [i ]) {
68- fprintf (stderr , "out of memory\n" );
69- return 1 ;
70- }
71- count = mbstowcs (argv_copy [i ], argv [i ], argsize + 1 );
72- if (count == (size_t )-1 ) {
73- fprintf (stderr , "Could not convert argument %d to string\n" , i );
57+ fprintf (stderr , "Unable to decode the command line argument #%i\n" ,
58+ i + 1 );
7459 return 1 ;
7560 }
61+ argv_copy2 [i ] = argv_copy [i ];
7662 }
7763 setlocale (LC_ALL , oldloc );
7864
You can’t perform that action at this time.
0 commit comments