Message105616
| Author |
vstinner |
| Recipients |
amaury.forgeotdarc, belopolsky, dangyogi, flox, gruszczy, r.david.murray, vstinner |
| Date |
2010年05月13日.00:14:22 |
| SpamBayes Score |
6.652291e-05 |
| Marked as misclassified |
No |
| Message-id |
<1273709666.24.0.195793955891.issue8256@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
This issue is directly related to issue #6697. The first problem is that the builtin input() function doesn't check that _PyUnicode_AsString() result is not NULL.
The second problem is that io.StringIO().encoding is None. I don't understand why it is None whereas it uses utf8 (it calls TextIOWrapper constructor with encodings="utf8" and errors="strict").
I will be difficult to write an unit test because the issue only occurs if stdin and stdout are TTY: input() calls PyOS_Readline(stdin, stdout, prompt).
--
@gruszczy: You're patch is just a workaround, not the right fix. The problem should be fixed in input(), not in PyUnicode methods. _PyUnicode_AsString() expects an unicode argument, it should raise an error if the argument is None (and not return a magical value). |
|