[issue5143] OS X: Py_SetProgramName argument has type char*; should be wchar_t*

Ned Deily report at bugs.python.org
Tue Feb 10 04:51:05 CET 2009


Ned Deily <nad at acm.org> added the comment:

Here's the results of testing the two patches:
- patch-mbstowcs.txt should not do a free on the buffer since
  Py_SetProgramName is expecting to hold on to it (like with
  the result of a getenv(3)).
- patch-remove-PYTHONEXECUTABLE.txt works as is.

However, neither of these patches in and of themselves fix all
the issues with OS X IDLE menus on 3.x (most of the issues are
present in 2.x as well).  See Issue5194, Issue5195, and Issue5196.
In particular, the patches in 5194 and 5196 also eliminate the
dependence on PYTHONEXECUTABLE influencing sys.executable.

So, just looking at IDLE, it would not hurt to remove the
PYTHONEXECUTABLE magic. On the other hand, it is a documented
behavior of PYTHON:

http://docs.python.org/3.0/using/cmdline.html#envvar-PYTHONEXECUTABLE

and removing it *could* add extra problems for people porting
over bundlebuilder-based apps or for whatever other reason they
might be using it.

So my recommendation is to fix PYTHONEXECUTABLE.  Attached patch
patch-nad0013-py3k-30.txt does so.  It also includes a fix for 
another very similar OSX-only 2.x->3.x wchar_t conversion problem
which also causes an "incompatible pointer type" build warning,
something I noticed while investigating this.  The patch has been
tested on both py3k and 3.0.  patch-nad0013t-py3k-30.txt adds
a test case for PYTHONEXECUTABLE behavior.

Added file: http://bugs.python.org/file13005/patch-nad0013-py3k-30.txt

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5143>
_______________________________________


More information about the Python-bugs-list mailing list