diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-03-22 08:19:04 -0400 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-03-22 08:19:04 -0400 |
commit | eff19a13ed4ca04e5be8c93a044952bad7de2054 (patch) | |
tree | 6f269bbd8a46c7ed9ba3c86577215fab030038dd /Python | |
parent | 0e3c1075495dfc1ed481f65091d1f9241868324a (diff) | |
download | cpython-git-eff19a13ed4ca04e5be8c93a044952bad7de2054.tar.gz |
check by equality for __future__ not identity (closes #14378)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/future.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Python/future.c b/Python/future.c index 96be757b2e..1ab7a1a104 100644 --- a/Python/future.c +++ b/Python/future.c @@ -59,13 +59,6 @@ future_parse(PyFutureFeatures *ff, mod_ty mod, const char *filename) { int i, found_docstring = 0, done = 0, prev_line = 0; - static PyObject *future; - if (!future) { - future = PyString_InternFromString("__future__"); - if (!future) - return 0; - } - if (!(mod->kind == Module_kind || mod->kind == Interactive_kind)) return 1; @@ -92,7 +85,9 @@ future_parse(PyFutureFeatures *ff, mod_ty mod, const char *filename) */ if (s->kind == ImportFrom_kind) { - if (s->v.ImportFrom.module == future) { + PyObject *modname = s->v.ImportFrom.module; + if (PyString_GET_SIZE(modname) == 10 && + !strcmp(PyString_AS_STRING(modname), "__future__")) { if (done) { PyErr_SetString(PyExc_SyntaxError, ERR_LATE_FUTURE); |