[Python-porting] main() -> Py_SetProgramName()

"Martin v. Löwis" martin at v.loewis.de
Wed Dec 5 13:53:01 CET 2012
  > Using the algorithm in main() is probably not the best 
recommendation either,
> because it uses non-public API methods such as _Py_char2wchar().  Perhaps
> these should be promoted to a public method, or we should add a method to get
> from main()'s char** to a wchar_t**.
>
> For now, I've tried to use mbsrtowcs(), though I haven't done extensive
> testing on the code.  I think Python ultimately uses mbstowcs() down deep in
> its bowels.
>
> There was some discussion of this back in 2009 IIRC, but nothing ever came of
> it.  I think MvL at the time was against adding any convenience or alternative
> API to Python.

If I said that, I may not have meant it this way. I may have been 
opposed to a convenience function that implicitly calls setlocale, which
in turn would be necessary before mbsrtowcs can do anything useful
(for non-ASCII characters).

> I'm happy to bring this up on python-dev, but I also don't want to have to
> wait until Python 3.4 to have a nice solution.

In which case a stand-alone convenience function could be provided, to 
be included in every project facing this issue.

Regards,
Martin




More information about the Python-porting mailing list