This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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;
}
History
Date User Action Args
2007-10-20 01:37:14christian.heimessetspambayes_score: 0.000517368 -> 0.00051736756
recipients: + christian.heimes, gvanrossum, brett.cannon
2007-10-20 01:37:14christian.heimeslinkissue1267 messages
2007-10-20 01:37:13christian.heimescreate