Message56586
| Author |
christian.heimes |
| Recipients |
brett.cannon, christian.heimes, gvanrossum |
| Date |
2007年10月20日.01:37:13 |
| SpamBayes Score |
0.00051736756 |
| Marked as misclassified |
No |
| Message-id |
<47195BC7.6020304@cheimes.de> |
| In-reply-to |
<1192843830.49.0.594251439172.issue1267@psf.upfronthosting.co.za> |
| Content |
Brett Cannon wrote:
> Brett Cannon added the comment:
>
> It looks like the file object returned by imp.find_module() has its read
> position WAY too far forward (at least on OS X).
That's strange. It should never read more than 2 lines of a file. I
don't understand how it could happen.
char *
PyTokenizer_FindEncoding(FILE *fp) {
struct tok_state *tok;
char *p_start=NULL, *p_end=NULL;
if ((tok = PyTokenizer_FromFile(fp, NULL, NULL, NULL)) == NULL) {
rewind(fp);
return NULL;
}
while(((tok->lineno <= 2) && (tok->done == E_OK))) {
PyTokenizer_Get(tok, &p_start, &p_end);
}
rewind(fp);
return tok->encoding;
} |
|