summaryrefslogtreecommitdiff
path: root/Python/future.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-03-22 08:19:04 -0400
committerBenjamin Peterson <benjamin@python.org>2012-03-22 08:19:04 -0400
commit7a47e4135954f91feb742530ebf6a0db0e80ef41 (patch)
tree3449d85b761c5bbf863d1bc8f041a78cda2d8fa9 /Python/future.c
parentd62a378333930db1871e842632e8b09c20794e90 (diff)
downloadcpython-7a47e4135954f91feb742530ebf6a0db0e80ef41.tar.gz
check by equality for __future__ not identity (closes #14378)
Diffstat (limited to 'Python/future.c')
-rw-r--r--Python/future.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/Python/future.c b/Python/future.c
index d6b653f315..978dc25306 100644
--- a/Python/future.c
+++ b/Python/future.c
@@ -60,13 +60,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 = PyUnicode_InternFromString("__future__");
- if (!future)
- return 0;
- }
-
if (!(mod->kind == Module_kind || mod->kind == Interactive_kind))
return 1;
@@ -93,7 +86,8 @@ 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 (!PyUnicode_CompareWithASCIIString(modname, "__future__")) {
if (done) {
PyErr_SetString(PyExc_SyntaxError,
ERR_LATE_FUTURE);