[Python-Dev] unicode imports

Bob Ippolito bob at redivi.com
Sat Jun 17 08:55:51 CEST 2006


On Jun 16, 2006, at 9:44 PM, Nick Coghlan wrote:
> Bob Ippolito wrote:
>> There's a similar issue in that if sys.prefix contains a colon, 
>> Python is also busted:
>> http://python.org/sf/1507224
>> Of course, that's not a Windows issue, but it is everywhere else. 
>> The offending code in that case is Modules/getpath.c,
>> Since it has to do with the definition of Py_GetPath as returning a 
> single string that is really a DELIM separated list of strings, 
> where DELIM is defined by the current platform (';' on Windows, ':' 
> everywhere else), this seems more like a platform problem than a 
> Python problem, though - you can't have directories containing a 
> colon as an entry in PATH or PYTHONPATH either. It's not really 
> Python's fault that the platform defines a legal filename character 
> as the delimiter for path entries.
>> The only real alternative I can see is to normalise Py_GetPath to 
> always return a ';' delimited list of strings, regardless of 
> platform, and update PySys_SetPath accordingly. That'd cause 
> potential compatibility problems for embedded interpreters, though.
>> I guess we could create a Py_GetPathEx and a PySys_SetPathEx that 
> accepted the delimeters as arguments, and change the call in 
> pythonrun.c from:
>> PySys_SetPath(Py_GetPath())
>> to:
>> PySys_SetPathEx(Py_GetPathEx(';'), ';')
>> (still an incompatible change, but an easier to manage one since 
> you can easily provide different behavior for earlier versions of 
> Python)

No, that doesn't fix anything at all. The right solution is not to 
provide for a different delimiter, but allow for a list (probably too 
early for PyObject* though) or array of some kind (e.g. int argc, 
char **argv).
-bob


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /