[issue1267] Py3K cannot run as ``python -S``

Christian Heimes report at bugs.python.org
Tue Oct 16 20:33:21 CEST 2007


Christian Heimes added the comment:

Christian Heimes wrote:
>  * removed unused import of open in initstdio()
>  * fixed infinite loop in PyTokenizer_FindEncoding() by checking
> tok-done == E_OK

I found another bug in Python/import.c:call_find_method. The function
mustn't set an encoding of ftp->mode contains 'b' for binary.

		if (strchr(fdp->mode, 'b') == NULL) {
			/* Python text file, get encoding from tokenizer */
			encoding = PyTokenizer_FindEncoding(fp);
			encoding = (encoding != NULL) ? encoding :
				   PyUnicode_GetDefaultEncoding();
		}

Christian

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1267>
__________________________________


More information about the Python-bugs-list mailing list