diff options
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/tokenizer.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index e2da3e5..e4cf8e4 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -448,8 +448,12 @@ fp_setreadl(struct tok_state *tok, const char* enc) if (io == NULL) goto cleanup; - stream = PyObject_CallMethod(io, "open", "ssis", - tok->filename, "r", -1, enc); + if (tok->filename) + stream = PyObject_CallMethod(io, "open", "ssis", + tok->filename, "r", -1, enc); + else + stream = PyObject_CallMethod(io, "open", "isis", + fileno(tok->fp), "r", -1, enc); if (stream == NULL) goto cleanup; |