Message118601
| Author |
vstinner |
| Recipients |
MrJean1, amaury.forgeotdarc, ixokai, loewis, mark.dickinson, michael.foord, piro, pitrou, ronaldoussoren, rpetrov, skip.montanaro, slmnhq, vstinner |
| Date |
2010年10月13日.23:31:42 |
| SpamBayes Score |
1.8163138e-11 |
| Marked as misclassified |
No |
| Message-id |
<1287012704.23.0.695383283591.issue4388@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> This issue should be fixed by r85435 ...
> I will watch for the OSX buildbots.
I don't know if it fixes the issue, but it introduces a regression. r85442 reverts it.
---
Revert r85435 (and r85440): decode command line arguments from utf-8
Python exits with a fatal error if the command line contains an undecodable argument. PyUnicode_FromString() fails at the first undecodable byte because it calls the error handler, but error handlers are not ready before Python initialization.
---
The problem is to get a function to decode a bytes string from utf-8 in main() (before Python initialization). Possibilities:
- Use PyUnicode_DecodeUTF8Stateful() and tell it to not call the error handler but exit immediatly (return NULL). Eg. check a flag (function argument or global variable?) to check if we should call the error handler or not
- Use _Py_char2wchar() and set temporary the locale to an utf-8 locale. The problem is to get an utf-8 locale. Is there an utf-8 locale which is always available?
- Another solution?
I prefer the _Py_char2wchar() solution because I'm sure that it works before Python initialization. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2010年10月13日 23:31:44 | vstinner | set | recipients:
+ vstinner, loewis, skip.montanaro, ixokai, ronaldoussoren, amaury.forgeotdarc, mark.dickinson, pitrou, piro, MrJean1, rpetrov, michael.foord, slmnhq |
| 2010年10月13日 23:31:44 | vstinner | set | messageid: <1287012704.23.0.695383283591.issue4388@psf.upfronthosting.co.za> |
| 2010年10月13日 23:31:42 | vstinner | link | issue4388 messages |
| 2010年10月13日 23:31:42 | vstinner | create |
|