Message 76242 - Python tracker

Message76242

Author mark.dickinson
Recipients MrJean1, mark.dickinson
Date 2008-11-22.12:37:16
SpamBayes Score 9.6999075e-12
Marked as misclassified No
Message-id <1227357438.29.0.284317754629.issue4388@psf.upfronthosting.co.za>
In-reply-to
Content
Here's a minimal failing example, which I believe captures the cause of 
the test_cmd_line failure.  After "export LANG=C", on OS X 10.5, I get:

Python 3.0rc3+ (py3k:67335, Nov 22 2008, 09:11:58) 
[GCC 4.0.1 (Apple Inc. build 5488)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, posix
>>> sys.getfilesystemencoding()
'utf-8'
>>> posix.execv(sys.executable, [sys.executable, '-c', "ord('\xe9')"])
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: ord() expected a character, but string of length 2 found

Clearly the single '\xe9' character is being encoded in utf8 as
b'\xc3\xa9', and the python interpreter invoked by the execv ends up 
receiving two characters here instead of one.

The encoding happens at around line 2988 of posixmodule.c, in posix_execv.
History
Date User Action Args
2008-11-22 12:37:18mark.dickinsonsetrecipients: + mark.dickinson, MrJean1
2008-11-22 12:37:18mark.dickinsonsetmessageid: <1227357438.29.0.284317754629.issue4388@psf.upfronthosting.co.za>
2008-11-22 12:37:17mark.dickinsonlinkissue4388 messages
2008-11-22 12:37:16mark.dickinsoncreate